Neuruss wrote: > Can't we just check if the string has digits? > For example: > > >>>>x = '15' >>>>if x.isdigit(): > > print int(x)*3 > > > 45 > > No, we can't. '-15' has non-digits but is a valid int.
Another point is that the try-except can also be used for string-to-float conversion.... -- http://mail.python.org/mailman/listinfo/python-list