15,190 Topics
![]() | |
Hi! I just started using Python yesterday and I have written a program that reads in a very large data file and rearranges the data so that it can be read into a different program. I am doing this for some engineering modeling simulations. I wanted to create an interface … | |
Ok, I would like to use a regular expression that I create dynamically to search and replace words in a file. For instance: import re fl = re.compile('abc|def|ghi') ts = 'xyz abc mno def' n = fl.search(ts) print n How would I find all matches in the string? So far, … | |
Hi. *** SHORT QUSETION: Is there a way I can run a <large> socket server withought having to have a thread for each client/socket created? ***LONGER EXPLAINATION IVe recently written a small network program, that sends messages over TCP or UDP... depending on user input. I want ot adapt that … | |
Hi, I have 2 modules, grepforapp.py and myApp.py. Basically i'm trying to make a 'search' utility. myApp makes the UI with one textbox for taking input, start button and a list box which displays the file names where the pattern was found. grepforApp walks through the dir tree and searches … | |
Dear All, I am trying to write the following code: def try1(n): a1="God Godess Borother Sister Family" a2=a1.split() a3=raw_input("PRINT A WORD") a4=a1.find(a3) print a4 a5=[] if a4>0: a5=a2.index(a3) a6=a5+1 a7=a2[a6] print "The new word is" print a7 a8=a5.append(a7) print a5 elif a4<0: a11=a3 print "The word is not availiable in … | |
I am currently trying to convert a program I just wrote to application form, on the Mac. I'm using py2app to accomplish this, and everything works fine up until the last stage; when I try to complete the conversion with: [code] python setup.py py2app [/code] and then run the resulting … | |
Here's my code: [code=python]from Tkinter import * import tkFileDialog import ImageTk import Image class GUI(Tk): def __init__(self, master = None): ## self.apfr = Frame() ## self.before = self.graphicWindow("Input") ## self.after = self.graphicWindow("Output") ## ## self.apfr.icon = Button(self.apfr, text = "Minimize", ## command = self.ico) ## ## self.apfr.quit = Button(self.apfr, text … | |
I made a Class, and I am trying to change a variable (a variable that I set up at the beggining of the program) from inside a Class. But an error pops up and says: "local variable 'widget_stock_price' referenced before assignment" I made the variable "widget_stock_price" at the beggining of … | |
It's always bugged me how it seems that the only way to find out where you are inside a for loop is to use a counter. For instance, suppose you want to iterate through a list, and print every entry on a second line, but for the second-to-last entry you … | |
Hi Guys What i am trying to do here is have a tuple of numbers, lets say X. Then i have a list of a few other tuples. I want the program to find the tuple that is closest in value. [code=python] x = (214,521) lis = [(200,500),(250,550),(300,600)] [/code] I … | |
I have a Python program that uses Mechanize to open a page at a website with a log-on/password form, set the entries to preset values and then submit to begin the session. This works, I can get the log-in/password from a form I build in the program. What I an … | |
Hi all, I want to append our own images with nodes and their children in a tree control. I am using wxPython and it has wx.ART feature which contains many custom images, but if I want some other images to be appended in a tree, what should I do? Please … | |
Hi all, I am using a tree control for multiple selections by implementing "wx.TR_MULTIPLE" property. The tree is bound by the event "EVT_TREE_SEL_CHANGING". On click of each item, value for that item is being populated.Similarly, The value should disappear on clicking the selected item again.Now,when I click the last item … | |
Hello, Here I go again. I have the simplest of ideas...yet cannot seem to find a solution to implement it: [CODE=Python] from socket import * import time BUFSIZE = 256 IP = 'localhost' PORT = 25000 ADDR =(IP, PORT) tcpCliSock = socket(AF_INET, SOCK_STREAM) tcpCliSock.connect(ADDR) tcpCliSock.send('I want a response from you … | |
i have been trying to create my python command prompt directory but always recieve this imformation "the system cannot find the path specified" please i will be glad if someone can shade more highlight on how to set the python command prompt directory | |
How do you add directories whose absolute path cannot be guaranteed. For eg, in the directory structure below, I would like to add the "personal", "personal/util", "personal/net" and "personal/lib" directory to sys.path. The "Python" directory could be sitting anywhere in the file system. I added [B]sitecustome.py[/B] to "Lib/site-packages", however, I … | |
Is there any way to put multiple lines of text in each selection part for the tkinter listbox? Thanks for the help. | |
Dear all, I installed Two applications in same PC, these two applications using import sys options my problem is i cant import Python path for Second application because in Import sys is tracking only first path in python path so how to import Second Path also using import sys regards … | |
Hi everyone. I'm using ReportLab to generate pdf report from my price list application. The application runs on windows xp o.s. and is made with tkinter. What the app make now is that when I press the printPdf button a pdf file with a preset name is created in the … | |
Hopefully this question is easier than I think it is. :) I have a directory with thousands and thousands of flv and jpeg files in it. I want to loop through the directory, get the file names and their sizes (in bytes) I've tried searching the web for a function … | |
I've been trying to program a "press any key to continue" function, simply because raw_input feels noobish, but so far I haven't been having much luck. I did a search and the opinions are nearly unanimous that getch() is the way to go, but...things haven't gone that well. Here's an … | |
Hi! I've been working with radio buttons and I've been having some trouble. The basic problem is that even though I can create the radio buttons (and I can select which one I want) that they don't do anything- nothing is printed or tells me what the "user" selected. Here's … | |
I have a list that is retrieved with python from MS Access. This list needs to be sorted alphabetically before being printed on the web browser. Here is what I have and I need it sorted by the P_LastName. [CODE]dbc = odbc.odbc('Intra//') csr = dbc.cursor() q = "SELECT P_ID, P_FirstName, … | |
Hi everybody! I'm trying to write a program that is able to look inside a txt file and change, for example, the first word with a similar word. The txt file will have one word for line. EXAMPLE::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ORIGINAL TXT FILE: tom lives CHANGED TXT FILE: mum lives :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: I … | |
Hi Guys.. Can someone explain to me what's the difference between sending any data over a socket vs sending an http request? i mean sending an http request would also be happening over a TCP socket, am i right? so basically it's as simple as sending data from client socket … | |
Hi, When i search for a pattern in a file how do i get the line and line#? basically i want to replicate the 'grep' command functionality. Now i can easily say whether the pattern exists or not using re.search funtion but i'm not able to print that particular line … | |
I am parsing an XML file with encoded entities in it (& and so on). If I use minidom to parse the XML file, minidom will unescape the entities and display the correct value. If I use pulldom, it skips the entity and moves onto the next line. For example, … | |
I've create a C program that makes a call to routines which I create inside of python...however when I copied the final exe to another machine the program crashed saying it couldn't find the python25.dll...tried looking for it but could not find it. Is it enough that we have this … | |
I would like to convert url into md5 hash. My question is that md5 hash will create collision at 2^64. If you do long(value,16), where value is the md5 hash string, would value returned from long(value, 16) be unique as long as md5 hashed string is unique? when you move … | |
Hello everybody! As I thought I became more comfortable with data structure I've got the problem I can't solve. It looks so: I have that kind of text file: ABCD vvvv 1e-12 ABCD hhhh 1e-6 ABCD ggggg 1e-3 ASDE ffffff 1e-57 ASDE dddd 0.001 etc. I would like to read … |
The End.