15,175 Topics
| |
I have a folder with my game on Desktop. I've installed py2exe, 'cause it seemed to be a very good game and I wanted to share it. Now, I did everything right (i followed youtube tutorial), but when I start command prompt and typed 'a.py py2exe' it returned a message … | |
I want to use MySQLDB to connect MySQL but I got a problem. the problem is: --------------------------------------------------------------------------------- cs6201:/home/lamwaiman/python/data # python dm.py Traceback (most recent call last): File "dm.py", line 11, in <module> import MySQLdb File "build/bdist.linux-i686/egg/MySQLdb/__init__.py", line 19, in <module> File "build/bdist.linux-i686/egg/_mysql.py", line 7, in <module> File "build/bdist.linux-i686/egg/_mysql.py", line 6, … | |
Hello again! I have a new question. I have run a script and wants to run it again with a "keypress" input from the user, how do i code that. Like this: import subprocess drive=input(" If you want to start the script again , press 1: ") if drive == … | |
hey all what is the best way to execute a certain function repeatedly after a certain period of time ? for example: the increment of a certain variable every second thx | |
Hi, I am using Linux, and I was looking for free source code ( Python) for speech recognition, I found "Speech" for Windows. I have tried to run it on Linux, I got errors of missing modules, I found most of them online but when I got this error: [COLOR="Red"]No … | |
i am making a game in python 2.3.5 and i wanted to know if there is a command that would make it so one sprite will move to another no matter what the position is on the screen. | |
Hello. I am stuck on a simple piece of code. For some reason it keeps saying it can't call the Str object. Im also unsure on how to float the data to 2 decimal points (i don't know where the 2.f% should go.) The task is to make a taxi … | |
Hi, It must be a simple issue, but couldn't find any answer googling. Here is the problem: I have a simple test application with a TextCtrl, Button and StaticText. When I press the Button, it must query PostgreSQL with ...[code]SELECT name FROM contacts WHERE name LIKE '%"+TextCtrl.Value+"%'[/code] and return the … | |
I've been working on a simple little PyGTK app that shows an icon in the system tray. When you right-click, the pop-up menu appears as expected. However, first the menu appears with just some up and down scroll arrows, and I have to scroll down before it fills in and … | |
how could i print the length of a parameter?.. like def length(word) gives the output "word 4"?.. I have no clue of what to do? def length(): len=length() | |
[CODE]import wx class McaMenu(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(640, 432)) menubar = wx.MenuBar() file = wx.Menu() new = wx.MenuItem(file, 1, '&New\tCtrl+N', 'Creates a new document') file.AppendItem(new) file.AppendSeparator() open = wx.MenuItem(file, 2, '&Open\tCtrl+O', 'Open New document') file.AppendItem(open) save = wx.MenuItem(file, 3, '&Save\tCtrl+S', 'Save') file.AppendItem(save) save = … | |
How could i index the program to output e.g. displayDate(10, 2, 2009) gives "10 Feb 2009" as the output. [code] def displayDate(day, month, year): Months = ['Jan', 'Feb', 'March', 'April', 'May', 'June', 'July', 'August', 'Sept', 'October', 'December'] [/code] | |
I have a string as such: str = 'C:\Process new\RF\test.dat' I need to replace all the backslashes with '/': res = 'C:/Process new/RF/test.dat' It is NOT a straight forward search and replace as I need to replace escape sequence (\). Any ideas? | |
hi there,i have installed win32all package for python 2.5 , but now the python IDLE does not load any more...whats the problem,thanks. | |
When I do the following: [code] s= serial.Serial('/dev/',9600) # or set a function and pass via command line s= serial.Serial(arg1,9600) [/code] The code executes without any error. [b]But[/b], when I use AJAX and POST the parameters to the script [code] def index(req): info = req.form sys.stderr = sys.stdout s= serial.Serial(info['device'],9600) … | |
Hi I am new to python and am learning how to use tkinter. I am creating a game and need to create callbacks for the buttons so the game has a cell location when a player clicks on the corresponding button. I am unsure on how to do this, hope … | |
Hi, I am new to here. I am doing with my honours project in University, it is about data mining. Before I can do data mining, first I need data. I want to extract data from a site : [url]www.tripadvisor.com[/url] Should I write my web crawler with python? I don't … | |
How can you check the length of a file / list and then use the value in an "if-loop" in python? I want to create a "if-sats" that must check the amount of elements(numbers) in a textfile, if the amount is less then 5 do this... else do that.. | |
Hi, The following is a GPS string: $GPGGA,092204.999,4250.5589,S,14718.5084,E,1,12,24.4,89.6,M,,,0000*1F $GPGSA,093345.679,4234.7899,N,11344.2567,W,3,02,24.5,1000.23,M,,,0000*1F $GPGSV,044584.936,1276.5539,N,88734.1543,E,2,04,33.5,600.323,M,,,*00 $GPRMC,199304.973,3248.7780,N,11355.7832,W,1,06,02.2,25722.5,M,,,*00 $GPVTG,066487.954,4572.0089,S,45572.3345,W,3,09,15.0,35000.00,M,,,*1F I want to extract the line following and including $GPGGAand $GPRMC.The GPS string length is variable.Please let me know how to do this and store each of them into a single string or 2 separate strings. thanks in … | |
making for practice a temp converter. i got the basic program to convert C to F. heres that part: C = input("what temperature (celius) do you need converted? ") print "%s degrees celsius is equal to %s degrees Farenheit" % (C, 32+(212-32) / 100.0 * C now im trying to … | |
import wx class McaMenu(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(640, 432)) menubar = wx.MenuBar() file = wx.Menu() new = wx.MenuItem(file, 1, '&New\tCtrl+N', 'Creates a new document') file.AppendItem(new) file.AppendSeparator() open = wx.MenuItem(file, 2, '&Open\tCtrl+O', 'Open New document') file.AppendItem(open) save = wx.MenuItem(file, 3, '&Save\tCtrl+S', 'Save') file.AppendItem(save) save = … | |
Hello! I have some probs with this code, somehow it dont loop 10 times as it should, just one? How do i make python use a testfil.txt that already exist? I dont want to remove the old data in the file just add new data to it? In this code, … | |
Hi, I have jest started learning Python. I would like to get some help on writing a script that would delete a set number of lines from a text file which looks like this : 1846440556 1846440521 1846440491 1846440505 1846441137 1846441102 1846441080 1846441331 1846441323 1846441315 ... ... Thanks in advance … | |
And I can't get anything I write to work. I'm so far off course I think I just need a working example of import hooks in action. I've looked for examples on the Internet, but they only show what looks like correct code. They never show that code in action. … | |
Hi everybody, I would like to implement a task but I'm not sure the best way to do it. I have some objects each of which has an attribute that represent the object coordinates as a tuple. I would like to find the neighbors of each object, that is the … | |
why do I only end up with one object in the list i want to keep appending I am sure the answer is simple, thanks studRoll = [] def GetInteger(i): try: return int(i) except: return 0 class stud: def __init__(self, a, n, m): self.age = a self.name = n self.mark … | |
How do I access windows environment variables using Python? eg. if I have the following: set junk=C:\temp\junk how do I access 'junk' from python? | |
Hi, I'm trying to parse an apache log file and match the IP addresses in it. This is my code so far: [CODE] import re ippattern = re.compile(r"\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b") def matchmyip(): if ippattern.search(line): matchedip = ippattern.search(line) print matchedip.group() [/CODE] Now given a line like this from a log file: [CODE]1999-08-01 00:00:00 … | |
(A quine is a program that produces its own source as its output, typically to a file.) [CODE=Python]import sys ifile = sys.argv[0] counter = 0 istream = open(ifile) source = istream.readlines() source[2] = 'counter = ' + str(counter + 1) + '\n' if counter == 0: original = str(ifile) source.insert(5, … | |
Hi, I used SCons to create a shared library (dll) from a c++ file (hello.cpp) below. Then I used Python and it ctypes library to load in the dll and call its functions. I can load the dll and call the main function, but nothing else. I cannot call the … |
The End.