[Python-talk] Does a string contain an integer
Cole Tuininga
colet at code-energy.com
Thu Apr 3 09:03:48 EDT 2008
On Wed, 2008-04-02 at 12:06 -0400, Lloyd Kvam wrote:
> I use var.isdigit() for simple input checks.
>
> >>> '1234'.isdigit()
> True
> >>> '12X34'.isdigit()
> False
For my needs, that's perfect. In this particular case, I know that the
numeric value I'm interested in will never be negative, and never
contain a fraction, so this option fits the bill perfectly.
My thanks. :)
--
A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
>> A: Top-posting.
>>> Q: What is the most annoying thing on Usenet and in e-mail?
Cole Tuininga
colet at code-energy.com
http://www.code-energy.com/
More information about the Python-talk
mailing list