how to get the length of a number
Claudio Grondi
claudio.grondi at freenet.de
Sun Jun 11 16:46:09 EDT 2006
Stan Cook wrote:
> Can anyone tell me how to get the length of a number. I know
> len(string) will get the length of a string, but it doesn't like
> len(int). I seem to remember something like %s string. I tried to set
> a variable = to %s int, but that doesn't work. Is there a function I've
> forgotten about to convert an integer to a string?
>
> Regards
>
> Stan
len('%s'%(1234567,)) gives 7
len('%s'%(1234**45,)) and len(str(1234**45))
give 140
Claudio
More information about the Python-list
mailing list