15,190 Topics

Member Avatar for
Member Avatar for mruane

Hey, I am trying to create my text adventure geared towards all of the frequent posters on daniweb's python forum, just alittle something to have fun with. But, it isn't going as planned. I used vegaseat's suggestion for combat, shuffling lists randomly to randomize hit/miss results. I think I did …

Member Avatar for Mouche
0
116
Member Avatar for sneekula

What is the most efficient way to spell a string in reverse, for instance s = "banana".

Member Avatar for Mouche
0
123
Member Avatar for mruane

i get this error when trying to run my program. Traceback (most recent call last): File "C:\Python24\secretgarden.pyw", line 12, in -toplevel- denaystart() File "C:\Python24\secretgarden.pyw", line 7, in denaystart prompt_login() NameError: global name 'prompt_login' is not defined

Member Avatar for vegaseat
0
152
Member Avatar for DarkFlash

Hey guys Just joined up the forum, I've been looking for a good community of python users! I'm 17 and I'm in colleg right now getting my transfer degree so I can go major in software development. I've worked with mostly web based langauges for the last couple of years …

Member Avatar for DarkFlash
0
269
Member Avatar for sneekula

If I have an integer like x = 12345, how do I separate that into individual integers 1, 2, 3, 4, 5?

Member Avatar for sneekula
0
119
Member Avatar for mruane

I hope this thread does not offend anyone. I get the impression that most of us are college age prog5rammers, so this might be easily solved. I am attempting to make a menstrual cycle calculator for my fiance. To begin with, I thought about going about it in the following …

Member Avatar for vegaseat
0
86
Member Avatar for Mouche

So if I want to store a list of items (such as a bunch of instances of a class), what's better to use: tuples or lists? I understand that lists are mutable, so what are the advantages to tuples?

Member Avatar for vegaseat
0
138
Member Avatar for DarkFlash

Hey guys, I'm just about done with a program and I need to know how to launch an IE window (or any browser I suppose) from the command prompt. Can anybody help me? thanks!:cheesy:

Member Avatar for DarkFlash
0
345
Member Avatar for Mouche

I was looking through the "beginner projects" looking for a way to use dictionaries so I could understand them better. I saw the caesar cipher suggestion and decided to run with that. I created a working one, but (as I saw in the "If...else") just because something works doesn't mean …

Member Avatar for Ene Uran
0
526
Member Avatar for Dwezill

Hello everybody I have develop a python script who can send message via MSMQ Queing. I use Python 2.2.1 and WIN32all-146 as library. Everything work fine on a W2k station, but if we try to use it on WinXP station it crash. The error message I got is " File …

0
50
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
114
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
105
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
160
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
340
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
94
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
112
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
216
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
195
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
274

The End.