In article <[EMAIL PROTECTED]>,
 "[EMAIL PROTECTED]" <[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.
> 
> /David

The most straight-forward thing is to try converting it to an int and see 
what happens.

try:
   int(s)
except ValueError:
   print "sorry, '%s' isn't a valid integer" % s
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to