15,190 Topics
![]() | |
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, … | |
[B]Background: [/B] I'm extracting values from a file which is sometimes an xls and sometimes an xlsx file. An xls is easily read with xlrd, but xlrd nor any other Python library (as far as I could find) supports xlsx, so instead I'm using[URL="http://github.com/dilshod/xlsx2csv"] xlsx2csv[/URL] to convert to csv and … | |
Hi! I'm trying to figure out if it's possible to graph a piecewise mathematical function using Python where the limits of the function are dependent on another variable (i.e., if a > b, graph f(x); if b > a, graph g(x)). I've been trying to google stuff about graphing, but … | |
| |
I have just started to learn python (Learning Python), and I am trying to move some files to another folder that are over a week old. I keep getting an error about the files not existing. import shutil, sys, time, os src = 'c:/users/wca36050/temp1' dst = 'c:/users/wca36050/temp2' now = time.time() … | |
I can't seem to get a comma embedded string (i.e. an LDIF DN value) to save as a key in an associative list without the value being interpreted as a list itself. I can't find a method that will cause the value of the string variable to be interpreted intact … | |
Hi guys, I'm new to the forum and to progamming. I've started following a set of online video lectures as an introduction to programming using python. One of the problem they asked to solve is to create a simple program that computes and prints the 1000th prime number. I got … | |
is it possible to link modules together and freeze them into an executable using cx_freeze? and how can you do it | |
I'm trying to decrypt some data from gpg files that I've downloaded. Downloading the files to a directory is no problem, but I'm having trouble actually decrypting them. Here's what I'm doing right now: [CODE]def extractGPGs(gpglist,path,gpgPath="\"C:\\Program Files\\GNU\\GnuPG\\gpg.exe\""): os.chdir(path) if not os.path.isdir("GPGFiles"): os.mkdir("GPGFiles") if not os.path.isdir("OtherFiles"): os.mkdir("OtherFiles") if gpglist == None: … | |
I'm writing an app that requires a list from Python to be read into an array in C++. The problem I'm having is that I can't get my code to work under any version of Python after 2.4, and I don't think I'm using any deprecated functions. It runs fine … | |
I am using regular expressions to look for certain keyword sin a string. At the moment I have got: import re thisText = "<meta http-equiv='content-type' content='text/html; cHarSet=gBk' />" n = re.compile(r'\b\s*charset=gbk[a-z]*', re.IGNORECASE|re.VERBOSE) print n.findall(thisText) this allows me to get the string, ignoring the case of the text. I also want … | |
When I write a code, I put time related codes in the beginning and at the end to see how many seconds it takes. Is it possible to write it as a module, and refer to it when i write a code just with a single line of code? [CODE]import … | |
Hi, I am trying to export http_proxy using following python script Though, it prints 'Successful', it is not setting proxy correctly. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ import os command = r"export http_proxy=http://my_username:my_password@proxy_server_address:3128" if os.system(command) == 0 : print("Successful") else : print("Unsuccessful") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ What will be the possible problem | |
hi! does anyone know how to convert excel file (xls and xlsx)(or even just xls) into csv preferably using xlrd and csv modules. i need to convert a specific excel sheet to csv. i need to create a csv file instead of using comma but semicolon. i am still not … | |
hello everyone! I wanted to create a priority queue in which there would be different dictionaries with their priority numbers. The major problem I'm experiencing is that the queue just prints the dictionaries without regard for their priority. Please what do I have to do so that the queue prints … | |
Is there a module in python that i can use to parse javascript??? I finding a module that parse out the error message like what the cssutils do when checking on css script. Thanks |
The End.