[EMAIL PROTECTED] wrote:

> How do I check if a string contains (can be converted to) an int? I
> want to do one thing if I am parsing and integer, and another if not.

        try:
            x = int(aPossibleInt)
            ... do something with x ...
        except ValueError:
            ... do something else ...

-- 
Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
   May it not be that, at least, the brighter stars are like our Sun,
   the upholding and energizing centres of systems of worlds, adapted to
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to