Re: Changing variable to integer

2006-12-17 Thread vertigo
On Sun, 17 Dec 2006 17:00:46 +0100, Juho Schultz <[EMAIL PROTECTED]> wrote: > vertigo wrote: >> > Perhaps you meant something more along the lines of this: >> > >> def PrintWordCountFloat(words): >> >number = 0 >> >for index, word in enumerate(words): >> >print "%s %f" %

Re: Changing variable to integer

2006-12-17 Thread Juho Schultz
vertigo wrote: > > Perhaps you meant something more along the lines of this: > > > def PrintWordCountFloat(words): > > number = 0 > > for index, word in enumerate(words): > > print "%s %f" % (index, word) > > number = number + 1 > > print "Total words: %d" %

Re: Changing variable to integer

2006-12-17 Thread vertigo
> Perhaps you meant something more along the lines of this: > def PrintWordCountFloat(words): > number = 0 > for index, word in enumerate(words): > print "%s %f" % (index, word) > number = number + 1 > print "Total words: %d" %(number) PrintW

Re: Changing variable to integer

2006-12-17 Thread Fredrik Lundh
vertigo wrote: > I receive such error: > File "p4.py", line 24, in PrintWordCountFloat > print "%s %f" % (word,words[word]) > TypeError: list indices must be integers please post the *entire* traceback message. see: http://effbot.org/pyfaq/tutor-i-need-help-im-getting-an-error-in-my-progra

Re: Changing variable to integer

2006-12-17 Thread Peter Otten
vertigo wrote: > I receive such error: > File "p4.py", line 24, in PrintWordCountFloat > print "%s %f" % (word,words[word]) > TypeError: list indices must be integers > > i call PrintWordCountFloat with hash table, keys are words(string) and > values float. > This part of the code: > > def

Re: Changing variable to integer

2006-12-17 Thread Diez B. Roggisch
vertigo schrieb: > > Hello > > I receive such error: > File "p4.py", line 24, in PrintWordCountFloat > print "%s %f" % (word,words[word]) > TypeError: list indices must be integers > > i call PrintWordCountFloat with hash table, keys are words(string) and > values float. > This part of the

Re: Changing variable to integer

2006-12-17 Thread Dustan
vertigo wrote: > Hello > > I receive such error: > File "p4.py", line 24, in PrintWordCountFloat > print "%s %f" % (word,words[word]) > TypeError: list indices must be integers > > i call PrintWordCountFloat with hash table, keys are words(string) and > values float. > This part of the code:

Changing variable to integer

2006-12-17 Thread vertigo
Hello I receive such error: File "p4.py", line 24, in PrintWordCountFloat print "%s %f" % (word,words[word]) TypeError: list indices must be integers i call PrintWordCountFloat with hash table, keys are words(string) and values float. This part of the code: def PrintWordCountFloat(words)