15,175 Topics
| |
This is the folder structure: [CODE]root common.py module1 somescript.py module2 someotherscript.py[/CODE] i need to import common.py from somescript.py and someotherscript.py I also need to import somescript.py from someotherscript.py | |
Hi all, Does anyone know how to search for a string or substring within a list. I have [CODE] def searchfilt(self): f = open("timeline1.csv", "r") reader = csv.reader(f) text = enterbox(msg='Please choose a highlighter search term', title='Highlighter ', default='', strip=True) lines = [] i = -1 self.listbox2.delete(0, tk.END) for i, … | |
I'm trying to make a fixed length output record, and I'm using a Dictionary as a lookup table to find a code based on the kind of car a person drives. The routine works fine; I the search the key for the car type, and the value returned is the … | |
I am trying to find a way to search a filename.rc file for a particular string. For now lets just say I am searching for the string PARTYHOST. After finding PARTYHOST in the file I would like to replace anything after it(so 192.168.0.1) with a new string which I have … | |
I need to write a loop that traverses the list and prints the length of [B]each element[/B]. So far I have this: [code] def countEachElement(): elements= ["spam!",'1',['Brie','Roquefort','Pol le Veq'],['1','2','3']] i=0 while i < len(elements): print len(elements[i]) i=i+1 [/code] But it's not counting each element of the lists inside the list. … | |
Hello, Im trying to get this program to display a receipt of the items bought with its price and total, but so far this is what I've acomplished, I've been trying for a long time now, to make it print the receipt in the win2 but I haven't been able. … | |
Howdy, I'm a GIS guy trying to get my hands dirty with some Python. What I'm trying to do is iterate through a file (shapefile), reading specific fields from each row of the file's associated table. The table has thousands of rows, which is why a Python script is handy … | |
Hi, I want to know how to read the binary file from 10th byte to 90th byte in a file size of 100 bytes and need to write the read data into new binary file. please help me in doing this. | |
Hi I have been trying to install the ERIC python IDE [url]http://www.die-offenbachs.de/eric/eric-links.html[/url] for a while now to no sucess. I could not i kept getting errors when installing the QT module [code] Determining the layout of your Qt installation... Error: Make sure you have a working Qt v4 qmake on … | |
hallo people, i want to start learning python and ruby for some projects i have anyone who knows a good resource site or books for this two languages. any books and where i can get them will be highly appreciated thanx in advance | |
Hi all I am newbie in python. I have a csv file with two columns first as source and second as target. There are multiple values assigned to keys in successive rows such as follows 1 -->4 1 -->5 1 -->8 1 -->12 2 -->4 2 -->17 2 -->14 2 … | |
Hi all I have written code there are two definition functions but the only way I can get the whole thing to work is to put some code outside the definitions. Does anyone know how to fix the code so that I can call it from another module. Please help … | |
I'm trying to write a gui which will continually update values obtained from a data measurement device. Orginally this was accomplished using a TKinter .after loop with a specified refresh time of 500ms. This snippet of code is called from the mainloop and updates the values once when it is … | |
The code is shamefully short, but here it is. Now you can listen to the many sound files in wave (.wav) format and boing, chirp, chime, bark, booh, laugh and mooh at the people around you. | |
Hi All! I'm creating a program using Python and compiling it with py2exe. I've the same problem of this topic, but I can't solve it because GUI2exe is not supported by Python26. [url]http://www.daniweb.com/forums/thread224403.html[/url] How could I solve this problem? | |
Hi All I have two tab-delimited files. I want to compare first column of testfile1 to first column of testfile2 to find if items in file2 are in file1 and write it to the new file. I have a following code but not working!! :(. [CODE]f1 = open('testfile1.txt') #f2 = … | |
Hello! I am trying to write a function that looks for a desired string pattern within a table (Countries). Look at the code. [CODE]def selectCountry(): print 'Enter country:' country = raw_input('> ') sql = '''select idCountries,CountryEn from Countries where CountryEn REGEXP '%s'''' cursor.execute(sql,(country)) result = cursor.fetchall() rowHead = 'Country ID','Country … | |
Hello! I have this simple funcion [CODE]def newUser(): print 'Choose a username?' Username = raw_input('> ')[/CODE] The variable 'Username' has to be used by other functions. How can I do it? Cheers! Dani | |
Hello! I have written a program where you have to give the path to directories and files as input. Is it possible to enable any kind of auto-completion when running the program? Cheers! Dani | |
i need help in controlling mouse click in python. Example would be 'clicking File menu --> Save Us--> Save' on its own. I have this code for launching an app, for example a textfile. but i dont know how to control its mouse click. Advice please. [CODE]import os class LaunchApp: … | |
| Hi, I am trying to find this string "QuickSearchResultsCOnfig" in a text file. The text file will contain this in several places. I need the following var QuickSearchResultsConfig = ['a','b','v','d','e 'f','f']; I need to replace the above with var QuickSearchResultsConfig = [['a',{hidden:true}],['b', {hidden:true}],'v','d','e 'f','g ']; My original approach: Store a,b,c,d,e,f,g … |
Hello! I'm fairly new to Python. Hopefully you can understand what I'm trying to accomplish here. I'm making a GUI that prints Parking Garage Tickets. I want to be able to post an expiration date on the ticket. I found out about timedelta, and it works if I put in, … | |
Hey- First time posting here so hopefully I explain everything correctly. [CODE] class sendbackcurricula(app.page): def GET(self): query = models.Curricula.query.all() map = dict() for x in query: x = x.to_dict() map[x['owner_id']] = x['title'] return json.dumps(map); [/CODE] The above code will return the last element held in the database at 'owner_id' and … | |
The basic idea for this program is to for me to enter a code to a corresponding website (which is already in a dictionary in the body of the program) and search that webpage for a specific phrase and return a value. This is so that I can check number … | |
Hi, I had write a script in perl to randamize hex value and get the results as attached. Which is decimal value-----hexadecimal value. If i want to get randomized hexadecimal value 0x12c8xxxx but not 0x12c80000, what can i do? (where xxxx is not zero but with some hex value) I … | |
How would you safely round a floating point number to the nearest integer ? Python has the built in function [icode]round[/icode], but it returns a floating point number [code=python] >>> round(4.9) 5.0 >>> help(round) Help on built-in function round in module __builtin__: round(...) round(number[, ndigits]) -> floating point number Round … | |
hi, I want to run an application that is compiled in python 2.5 in fedora 13 but fedora 13 comes with python 2.6.4 so i manually install python 2.5 to run the application but it is saying that no module named gtk .. how to set path for gtk for … | |
Here is my practise with [URL="http://www.boggled.org/"]boggle [/URL]letter square non-overlapping word finder after some drastic debugging and cleaning. I think it is reasonable speed also. Comments wellcome. | |
hi there, i have some binary data (zip files, music, etc..)stored in a database, how can i start those files in memory without saving them to HDD..or even to temp files folder... thanks. | |
Hello! I am trying to run the code provided in the texttable module documentation ([URL="http://jefke.free.fr/coding/python/texttable/"]http://jefke.free.fr/coding/python/texttable/[/URL]) as shown in the code, but it returns a name error which tells that Texttable is not defined. [CODE]import texttable table = Texttable() table.set_cols_align(["l", "r", "c"]) table.set_cols_valign(["t", "m", "b"]) table.add_rows([ ["Name", "Age", "Nickname"], ["Mr\nXavier\nHuon", 32, … |
The End.