15,190 Topics
![]() | |
Hi, I have just started to learn python. I have installed and set the environment variables as per documentation. And from command prompt, I execute some python script,too. But I can't execute multiple line script, if the script contains any function. For example, see the following code - >>>a,b=0,1 >>>print … | |
If this is my np array: [ [ 1 2 3 4 ] [ 5 6 7 8 ] [ 9 0 1 2 ] ] I want to turn it into: [ [ 4 3 2 1 ] [ 8 7 6 5 ] [ 2 1 9 0 … | |
Hello! I have this funtion to delete a record from a MySQL table: [CODE]def delUser(): #Delete user #Ask for user to delete Username = raw_input('Which user would you like to delete? ') #Delete user delUser = '''DELETE FROM Users WHERE Username = %s''' cursor.execute(delUser,(Username)) db.commit()[/CODE] The problem is that it … | |
I have recently tried installing cherrypy to no avail, and it got me wondering, is there a way to build websites using the wxpython toolkit? if somebody knows the answer and could point me in the right direction it would be a massive help | |
Ok, back to differences between 2.x and 3.x... I have the following code to convert the sort key to a float: [CODE]def sort_key_func(row): return float(row[76][0:5]) [/CODE] which (under 2.x) returned the value of the field in the current row in position 76 for a lengthof 5. It was called like … | |
Well i have a small code snippet which is a basic http server. Well its running fine , but i am unable to catch the feedback and store it in a log file of my own for further analysis. code snippet : [URL="http://codepad.org/MppnYU9n"]http://codepad.org/MppnYU9n[/URL] just in case wondering on how to … | |
[CODE]I want to download attachments from email and search through them for a string of characters such as http://. The attachments will be in many formats, .doc, .html, .pdf. I am unfamiliar with mime and wanted to know if there is a way i can parse through the mime to … | |
I recently tried to run some scripts in Python on my .db file, but whenever I try to establish a connection, I get the following error: [code = python] >>> conn = sqlite3.connect('C:\Users\1545User\Documents\SEETA\ShruthLaikh\dict2. db', isolation_level=None) Traceback (most recent call last): File "<stdin>", line 1, in <module> sqlite3.OperationalError: unable to open … | |
i want explore the use of PIL but my first try got me this error : ImportError: " No module named ImageGrab " i tried it in terminal by typing 'python -v', 'import Image' but im broke. please help! thanks[CODE] import ImageGrab capture=ImageGrab.grab() capture.save('screen.png')[/CODE] | |
Is there any way to get a border like this in Tkinter? Notice how it lacks the buttons on the top right. Also I don't want this program to show in the task bar. This is in windows 7, btw. | |
If I created Tkinter window with some text that filled the whole window and now wanted to replace the window with a new text, is there a way to refresh the window? For Example: a= 100 win= Tk() win.geometry("500x300") while a > 0: if a%2 == 0: lbl = Label … | |
Just a curious Question, Is there a way of putting Vpython in wxpython as we do in case of wx.MediaCtrl and other stuffs? | |
Can someone tell me how to display an image with pygame. By the way I am using python 3.x. | |
In my projet, I can't find how to determine which image and pixel coordonate at clicking image in different ScrollArea. The result was showing in statusBar() area. (See screenshot) I put a code in txt file with 2 jpg use with it. Thanks in advance. | |
Please help me with this bug. I have python 3.0 and I was using pygame and for some reason it isn't reconizing [CODE]windowSurface[/CODE] here Is the code Im having problems with and thanks in advance. [CODE]import pygame, sys, random from pygame.locals import * #*******************************************SETUPVAR************************************************** BLACK = (0, 0, 0) WHITE … | |
I have this sequence in the text file >sp|P20905|5HT1R_DROME 5-hydroxytryptamine receptor 1 OS=Drosophila melanogaster GN=5-HT7 PE=2 SV=1 MALSGQDWRRHQSHRQHRNHRTQGNHQKLISTATLTLFVLFLSSWIAYAAGKATVPAPLV EGETESATSQDFNSSSAFLGAIASASSTGSGSGSGSGSGSGSGSGSYGLASMNSSPIAIV SYQGITSSNLGDSNTTLVPLSDTPLLLEEFAAGEFVLPPLTSIFVSIVLLIVILGTVVGN VLVCIAVCMVRKLRRPCNYLLVSLALSDLCVALLVMPMALLYEVLEKWNFGPLLCDIWVS FDVLCCTASILNLCAISVDRYLAITKPLEYGVKRTPRRMMLCVGIVWLAAACISLPPLLI LGNEHEDEEGQPICTVCQNFAYQIYATLGSFYIPLSVMLFVYYQIFRAARRIVLEEKRAQ THLQQALNGTGSPSAPQAPPLGHTELASSGNGQRHSSVGNTSLTYSTCGGLSSGGGALAG HGSGGGVSGSTGLLGSPHHKKLRFQLAKEKKASTTLGIIMSAFTVCWLPFFILALIRPFE TMHVPASLSSLFLWLGYANSLLNPIIYATLNRDFRKPFQEILYFRCSSLNTMMRENYYQD QYGEPPSQRVMLGDERHGARESFLD I want to split this into list as [[COLOR="Red"]'[/COLOR]>sp|P20905|5HT1R_DROME 5-hydroxytryptamine receptor 1 OS=Drosophila melanogaster GN=5-HT7 PE=2 SV=1][COLOR="Red"]'[/COLOR],[COLOR="Red"]'[/COLOR]MALSGQDWRRHQSHRQHRNHRTQGNHQKLISTATLTLFVLFLSSWIAYAAGKATVPAPLV EGETESATSQDFNSSSAFLGAIASASSTGSGSGSGSGSGSGSGSGSYGLASMNSSPIAIV SYQGITSSNLGDSNTTLVPLSDTPLLLEEFAAGEFVLPPLTSIFVSIVLLIVILGTVVGN VLVCIAVCMVRKLRRPCNYLLVSLALSDLCVALLVMPMALLYEVLEKWNFGPLLCDIWVS FDVLCCTASILNLCAISVDRYLAITKPLEYGVKRTPRRMMLCVGIVWLAAACISLPPLLI LGNEHEDEEGQPICTVCQNFAYQIYATLGSFYIPLSVMLFVYYQIFRAARRIVLEEKRAQ THLQQALNGTGSPSAPQAPPLGHTELASSGNGQRHSSVGNTSLTYSTCGGLSSGGGALAG … | |
Hello friends, I have a small problem with printing/getting exceptions in 3.1 version. My code is: [CODE=Python] try: # bla bla... except Exception, e: # here I got error message "Invalid Syntax" in the comma self.setError(e) return False [/CODE] What is the correct syntax in python 3.1 to get the … | |
Hi Everyone, Thanks in advance for any help. I am fairly new to programming python, and I and another person are developing a simple educational (graphical) tool that shows variable referencing for any python code that I run in my own defined local and global name spaces. The problem I … | |
anyone knows how to launch an application, for example, a .exe, in mac?? this code works for me in ubuntu, i tried it in mac but its not working: [CODE]os.system('gnome-open ' + path)[/CODE] | |
I am wondering how to write a function that prints values of tree nodes from a root to a lowest child. If the tree looks like [CODE] 1 2 3 4 5 6 7 8[/CODE] then the output should be 1 3 6 8. My function is [CODE]def traverse(node): if … | |
How would you modify this gui code to designate only certain spots on your canvas to drop your image? Like when your playing solitaire and the game only allows you to drop your card in a certain spot. [URL="http://www.daniweb.com/forums/post1111987.html#post1111987"]http://www.daniweb.com/forums/post1111987.html#post1111987[/URL] | |
Is there a way to accomplish the following in python? [CODE=javascript] try{ // something } catch (e) { // display e.message, e.name, e.linenumber } [/CODE] | |
Hi, First off, I'm a real greenhorn so please forgive me asking questions which may be bleeding obvious, but I have searched and searched and cannot find an answer to my problem. I'm trying to import a CSV file into sqlite3 database in python. The CSV file has 56 columns … | |
What approach should I use to return all dict keys that have the maximum value. The code below outputs 1, but I would like for it to return 1, 2. [CODE]import operator d1 = dict() d1[0] = 1 d1[1] = 2 d1[2] = 2 maxValue = max(d1.iteritems(), key=operator.itemgetter(1))[0] [/CODE] | |
Ive been trying to make a simple program that if i press the 'TAB' button it automatically presses 'Alt' (in a loop) Also i want it to work when python isnt the main program im using, like say a macro program. import pygame while True: if pygame.K_TAB: ye nvm im … | |
Hi, I'm using BeautifulSoup to parst html pages. I wrote a recursive function to traverse the parsed tree and extract NavigableStrings, add them to a string. Then return the string. The problem is my recursive skills sucks. I know I'm initializing the (Text) string each time the function is called. … | |
im a newbie to python, still learning as of today. as a part of my 'self-training' i listed some topics to practice every week but i was not able to run it successfully and im stuck. what i wanted with my activity is for it to read a .txt file … | |
Hello people, I am currently working on a program for comparing texts. Everything is working fine thanks to your help. However, I would like to have my program resize everything when the player resizes the main Window. I have managed to do so, but something feels amiss... Can you help … | |
Hi, a simple question: how do I enable deleting inside a python program? I have a python program that asks for user input, users write some words and then press enter. The problem is they can't use backspace or supr to delete anything, instead, the program prints ^? each time … | |
I'm writing a code that should extract tags from an HTML code (I'm skipping parts about parsing and stuff). I'm testing it using a simple fixed string however, it doesn't remove this <div> tag and I have no idea why... Thanks... [CODE]import re RegExpression_Tags = r"<.*?>" html = """ <div … |
The End.