Problem with a dictionary program....

Russell Blau russblau at hotmail.com
Tue Sep 28 09:56:11 EDT 2004


"Ling Lee" <janimal at mail.trillegaarden.dk> wrote in message
news:415966e1$0$23075$ba624c82 at nntp05.dk.telia.net...
>
> and I have to use the raw_input method to get the number:
>
> indput : raw_input(" Tell me the number you want to transform to textuel
> representaion")
>
> The I have to transform the input to a string
> indput = str(indput)

Actually, the value returned by raw_input() *is* a string, but you might
want to check to see whether the user has actually typed in an integer as
opposed to typing, say, "Go away you stupid computer."

try:
    indput = str(int(indput))
except ValueError:
    print "No, you need to give me an integer."

> Will one of you be so kind and tell me how I count the lengt of the indput
> number i was thinking on something like input.count[:] but that dosnt
> work...

You could consider using the built-in function len().


-- 
I don't actually read my hotmail account, but you can replace hotmail with
excite if you really want to reach me.





More information about the Python-list mailing list