Pythonic way to determine if a string is a number

python at bdurham.com python at bdurham.com
Mon Feb 16 00:28:39 EST 2009


Scott,

> Pretty good, but what about 0x23?
> 
<snipped>
> num = int(input, 0) # Convert to int, base spec in arg
>

Very nice! I wasn't familiar with the use of 0 as a radix value. A quick
visit back to the documentation and I'm an enlightened man :)

Thanks for your feedback,

Malcolm



More information about the Python-list mailing list