15,181 Topics
| |
I am beating my head against an python, cygwin, windows problem that I can not resolve. The script is executing os.system(command) which is OK but os.system is executing in an "sh" shell. I have cygwin installed on my system but I just want the commands executed in a cmd environment. … | |
hello all,i hope you all can help for this,i want showing image by clicking button,i have 5 button with parents panel 1 and i want show image to panel 2,my plan the image can be drag or rezise and image show all the time user want,i have idea for drag … | |
Hello People! I'm trying to design a text editor using wxpython. I wish to add some basic formatting functionality (like BOLD, ITALICS, UNDERLINE) to it. Is there any way to achieve this in wx.TextCtrl ? Or do I have to use stc.StyledTextCtrl (which I don't really wish right now)? Thank … | |
Hello. I have been finding more and more databases that output in XML. (Getting more popular all the time I guess!) I am building a script that will take this apart so I can edit items and put it back together in XML format and .cvs format. (to feed to … | |
i've been playing around with python for some time now, and i decided to take vegaseat's advice to make a project of mine own. the project consist of transforming an access database to xml, and then from xml generate some html files. i exported one table, made some basic modifications … | |
So I've been trying to make a VERY simple calculator program, but I tried so many things, and all of my methods failed. I've been at this for weeks, and I'm pretty frustrated up to this point. Nothing calls back on the entry box correctly, and although at certain points … | |
I found this very nice tutorial on what Python generators are and how they can be used: [url]http://www.neotitans.com/resources/python-generators-tutorial.html[/url] I had a difficult time with the other tutorials out there because, funnily enough, they seem to assume that you already know what generators are before they try to teach you about … | |
[code=python] s1 ='999' s2 = '99.99' mypat = re.compile('(^([0-9]+[.]+[0-9]+)|([0-9])$)') rate= mypat.search(s1) print rate.group() >>> print rate.groups() ('9', None, '9') >>> rate=mypat.search(s2) >>> print rate.group() 99.99 [/code] I need to get price = float(rate.group()). Price=999 or Price=99.99. I think there is a problem when s1='999', when I do this: [code=python] >>> … | |
i know how to create a dictionary but how do i search for a pattern in a file and then create a dictionary based on the search | |
I'm pretty new to the python programming and I am currently trying to create a factorial function which I have, but now I an trying to get it to list the positive integer n as input and then computes and outputs, in separate lines, 1!, 2!, 3!, ..., (n-1)!, n! … | |
hi guys i have a proble to solve but i do not have a clue what the problem is asking me to do i need some help. i allready know this that a fibonacci sequence i generated by the fuction Fn=fn-1+Fn-2 but the problem says that i need to to … | |
Why you specify type and name of the exception in your custom exceptions, but not in python built in exceptions? except IOError: print "no file by the name ccy_rates*.txt" except MyError, e: print e.msg | |
I am trying to use BeautifulSoup: soup = BeautifulSoup(page) td_tags = soup.findAll('td') i=0 for td in td_tags: i = i+1 print "td: ", td # re.search('[0-9]*\.[0-9]*', td) price = re.compile('[0-9]*\.[0-9]*').search(td) I am getting an error: price= re.compile('[0-9]*\.[0-9]*').search(td) TypeError: expected string or buffer | |
Hi I am new to the forums and to Python! I am having trouble displaying a text menu in the following format 1: Name 2: Name 3: Name It displays it correctly but then it gives an error message: Below is the code with output and error message. #CreateMenu.py #Create … | |
Can anyone help me anything related to --- how to draw 3D objects like sphere, cone, arrow, ring etc. I am new to python but know the basic language. Thanx, Anjali | |
I am developing an application that will run on a PDA and it requires some special layouts and looks for the widgets. The PDA has a touch sensitive screen and the application is used by pressing on the display with the finger tips. Because of this I need to make … | |
Currently I have a list that I have read from a file and it looks similar to... file = [S,D,S,D,S,D,N,S,D,S,D,N] What I was wondering is there a way to loop through the list so that I get multiple lists. For Example.... List1 = [S,D,S,D,S,D,N] List2 = [S,D,S,D,N] If someone could … | |
Hi, (by the way, this site is one of the best forum (display) I 've seen). I have a big issue I would like to resolve, let me explain; I have built a script where I can put IPs into a list and then once I press 0, this list … | |
I am trying to use the bit fields in a useful way to create packed fields that can be sent out as packets. Let's see if my code can help explain: [code] from ctypes import * class myPacketHeader(Structure): _pack_ = 1 _fields_ = [("seqnum", c_ubyte, 8), ("is_command", c_uint, 1), ("address", … | |
ok, I have a list of numbers and i want to return values in a range that are not in the list of numbers... I'm thinking of something like this: [ number for number in range(1, 10) if != nums ] However, This always prints all the numbers in that … | |
Im trying to figure out how to compute a product of ordered pairs. So if I have two sets (1,3) and (2,4), I want to generate the following tuples (1,2), (1,4), (3,2), (3,4). Now I wrote the following [INLINECODE]def orderedproduct(set1, set2): op=[set()] for x in set1: for y in set2: … | |
I have another problem. Same dataset as before. I have a huge collection of floats. I have a multi-dimensional list. About 37 per list, and over 60,000 lists. So something like: [[16166.00, 4123.15, ...], [761.1364, ...]]. I'm trying to find the [url=http://en.wikipedia.org/wiki/Euclidean_distance]Euclidean distance[/url] between one list with each of the … | |
I know there have been several posts concerning Python and CGI / HTML, but I can't get my little script to even print a web page. [code] #!/usr/bin/python print "Content-Type: text/html\n\n" print import sys sys.stderr = sys.stdout import cgitb; cgitb.enable(display=0, logdir=".") print """ <html> <body> <div align="center"><font style="font-family:verdana; font-size:18px">Hello from … | |
test = [random.randint(1,10) for i in range(20)] Can someone what does the random.randint(1,10) fron to for loop does, and the square brackets around it means, make it a list? | |
I need to create python script that is threaded. So the main program will run in infinite loop and just retrieving messages and putting them in a queue. (Main thread) I need child threads from a pool to process the queue. When there is no stuff in the queue, they … | |
name = raw_input("What is your name (Last, First)?") first = name.find(', ') print "Hi", first, "!!!" | |
I cannot figure out the correct way to de-serialize a string passed via xml-rpc. If I print out the string I get [code] {'params': ['123', 3], 'methodName': 'function'} [/code] I could split the string, and then drop unwanted characters. But, that seems like the wrong way. Any help would be … | |
Hi, I have a class [inlinecode]SubDevice[/inlinecode] with a function [inlinecode]action[/inlinecode]. For each instance of SubDevice I want to define another action, so it's a parameter of SubDevice's class constructor. Now some of the action functions need additional parameters, but that's normally not a problem because I can write something like … | |
Ok so I'm trying to use menu bars to grey out different widgets in my gui il show you all the lines that i think are important and the error messages for each command i have tried. [CODE]root = Tk() input_text = Text(root, height = 10, width = 25).grid(row = … | |
I recently installed Linux (Slackware Linux 12) on my laptop. On Windows I used IDLE for my python development, but on Linux, IDLE looks HORRIBLE. I tried tweaking the settings but it still looks bad, and is hard to program in. Can anyone recommend a good IDE for Python that … |
The End.