15,180 Topics

Member Avatar for
Member Avatar for mruane

Alright, so far, what I think the problem begins with is not having a full understanding of syntax, and tabs versus spaces. I have my tab set to four spaces. When I run the following code, the Python GUI (the black ms-dos looking thing, right?) flashes for only a few …

Member Avatar for vegaseat
0
170
Member Avatar for msaenz

Hi, I am trying to parse multiple xml files with sax using python but i for some reason i am having an issue: if someone can just help me get through this part, I would greatly appreciate it. It is parsing to get the attributes amount,unit and the ingredient name. …

0
66
Member Avatar for macca1111

Hi, A simple question I think. I want to create a function that updates variables if a certain condition is met. For example def main(): c=d=e=0 if c[1] == 0: c=c+1 d=d+1 e=e+1 I want to create a function that adds the 1 to c,d,e automatically. def BB(c,d,e) Add 1 …

Member Avatar for Ene Uran
0
80
Member Avatar for gbs

Greetings, In a Python script ("test.py"), I used os.system to execute a c executable "grerand", like below: os.system ("./grerand sequence sequence 1000") If I use this script as a CGI script and invoked it via the web (in this case, the invoking user is an apache user). It gave me …

Member Avatar for Ene Uran
0
113
Member Avatar for Mouche

hey... I wasn't able to find much information on these class methods other than __init__ ... could you explain what these (and maybe some others) do or perhaps just give me a link to a page that explains them: def __repr__ def __str__ def __cmp__

Member Avatar for Mouche
0
104
Member Avatar for Mouche

I searched the forum and couldn't find anything on this, so I guses I'll give this tiny topic its own thread. What's the point of creating a main() function and calling it at the end of your program? Are there advantages to this method in comparison to just writing the …

Member Avatar for vegaseat
0
136
Member Avatar for Mouche

say you have a list: [php] list = [1,a,2,b,3,c,4,d,5,e,6,f,7,g,8,h,9,i,10,j,11,k,12,l,13] [/php] What's the easiest loop set up if I want to store each number (every other slot) into another list? The above list is actually text from a file read and then split with "1 a" and such on each line …

Member Avatar for vegaseat
0
159
Member Avatar for HLA91

Hi When i place this in my script import time.sleep (2) i would like my script to wait for 2 seconds then continue. But when i run it the left bracket is highlighted in red then when iremove the left bracket as i assume that is not supposed to be …

Member Avatar for vegaseat
0
173
Member Avatar for HLA91

Hi Im looking for a time delay code so my script runs to certain line waits for the time specified then continues.Ive found some but they seem to long and complicated. any ideas or links, books ect... Many Thanks HlA91 STAY COOL AND DONT GET STRESSED!:cool:

Member Avatar for Mouche
0
328
Member Avatar for macca1111

Hi, I have the following code: import string def main(): rank=[] suit=[] fname=string.split(open('H:\card.txt').read()) for line in fname: rank.append(line) print rank The file (card.txt) is: 2 h 3 h ... How's the easiest was to get the 2 into rank and the h equal hearts Ultimately i need it to print: …

Member Avatar for Ene Uran
0
124
Member Avatar for theking11

So a kid in my class wanted more of a challenge...the professor gave us one...and I have no idea on this problem. Here's the instructions: Darts scorer. Write a program that draws a darts target and allows the user to click on the target to represent darts hitting the target. …

Member Avatar for Ene Uran
0
3K
Member Avatar for mruane

I recently downloaded Py2exe to make my python2.4 programs executable in motive of possible distribution. I looked online, and most of them tell me I need to use my ms-dos prompt, or command prompt. If these are two different things on my Windows 98 O.S., i cannot find command prompt. …

Member Avatar for Ene Uran
0
93
Member Avatar for macca1111

Hi, If the following def shows if a deck is empty, how do I change it to show the number of cards left??? def isEmpty(self): return (len(self.cards) == 0) I was thinking just taking the ==0 should work, by returning number of cards. macca1111

Member Avatar for Ene Uran
0
108
Member Avatar for sneekula

With the ease of argument passing to and from functions in Python, why would anyone want to use global variables. Isn't that an open invitation for mistakes to happen? Yet, I see code in threads here that abound with globals. I am a little confused here.

Member Avatar for jrcagle
0
139
Member Avatar for macca1111

Hi, I was running Python 2.3 an although I had a few problems it generally worked. I today tried to upgrade to 2.5 and it installs (apparantely) ok, yet when I click on the IDLE icon nothing happens. No error message, nothing. I can however click on the Python (Command …

Member Avatar for macca1111
0
78
Member Avatar for HLA91

Hi Ive got this word count script when i check it there is no probs but when i run it it says Traceback (most recent call last): File "H:\Scripts\count.py", line 9, in <module> infile = file(data, 'r') NameError: name 'data' is not defined This is my script #The number of …

Member Avatar for bumsfeld
0
179
Member Avatar for cancer10

Hello Friends, I am willing to learn python, so can someone please guide me how do I get started? I mean wot compiler would I need and which editor etc Also tell me wot is the scope of python in web programming? Thanx

Member Avatar for HLA91
0
215
Member Avatar for HLA91

Hi The info "joeprogrammer's" gave me to place the python directory at the end of my path but im confused. My path at the moment looks like this %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\ATI Technologies\ATI Control Panel;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Common Files\Adobe\AGL Python on my pc is in my H:\ drive under a folder called python. …

Member Avatar for vegaseat
0
194
Member Avatar for HLA91

Hi i Made a shell script like this [code] name = raw_input ("Please enter your name: ") if name == Harry: print "Welcome" else: print "you smell" [/code] What i want it to do is ask for my name and if i dont enter Harry it says "YOU Smell" But …

Member Avatar for vegaseat
0
162
Member Avatar for sneekula
Member Avatar for vegaseat
0
273
Member Avatar for mruane

Hey all. I was hoping somebody on here, preferably vegaseat or any other long time and reputable poster and/or moderater would have any Ideas for a program that I should write. Basically, I fear I am trying to push myself to hard and to fast with python. I really want …

Member Avatar for Ene Uran
0
112
Member Avatar for sneekula

I have played with Python code just a little and like it so far. I am using a Windows XP machine and have downloaded Python 2.5. As recommended in the "Starting Python" thread, I am saving my test files in the directory C:\Python25\Atest\. When I bring up the IDLE editor, …

Member Avatar for sneekula
0
108
Member Avatar for mruane

Hey, I know that was tacky but I am a closet geek so what can I say. I guess I am supposed to introduce myself here, so here goes. Forgive me if I am to in depth, I enjoy writing. I am 22 years old as of September 16. My …

Member Avatar for happygeek
0
83
Member Avatar for HLA91

Hi Im interested in downloading pythhon and i was looking through the first steps to making a python script. This was in the tutorial " [B]Setting the path[/B] You will need to cause the directory containing the file named [B]python.exe[/B] to be listed in your system environment variable named [B]path[/B]. …

Member Avatar for ~s.o.s~
0
95
Member Avatar for sneekula

I thought function xrange would give me a list of integers, but I got a string instead: [code]x = "xrange(1, 5)" print x # xrange(1, 5) x = xrange(1, 5) print x # xrange(1, 5) same result as string above!? [/code]

Member Avatar for sneekula
0
91
Member Avatar for katharnakh

Hi, i am facing some problems with opening an excel file. I am using XLRD module. I am getting XLRDError: Can't find workbook in OLE2 compound document and CompDocError: Not a whole number of sectors exceptions in seperate try on different files. 1.Does any one know anout these exceptions? what …

Member Avatar for vegaseat
0
328
Member Avatar for mruane

hi, first off I want to say that I was helped immensely by the other posts, especially the one where the one person was talking about classes. From veiwing his coding i was able to get my text adventure started. My basic questions are: 1) how do I learn the …

Member Avatar for bumsfeld
0
107
Member Avatar for akadri

Folks, I want to know how to check whether a file exists for not?? One more thing: If we open an existing file in a write mode, then it gets truncated to zero length, so what the way out of this?? Should I use open('filename','w+') Regards, Asrar

Member Avatar for katharnakh
0
85
Member Avatar for Mouche

I wasn't able to find anything on this... well, I wasn't sure what to search for. But I'm curious what the advantage of this: age = 3 print "Hello, I am %d years old." % age ...is over this: age = 3 print "Hello, I am", age, "years old."

Member Avatar for Mouche
0
147
Member Avatar for Matt Tacular

I want to make a program that can do two things really: 1) Detect the beat of a song 2) Output through a port, preferably the paralell port. 1) I was thinking the easiest way to do this, would be to use windows media players bars visualization, but then i …

Member Avatar for vegaseat
0
128

The End.