which is the best way to check if a string is an number or a char? could the 2nd example be very expensive timewise if i have to check a lot of strings?
this
value = raw_input()
try:
value = int(value)
except ValueError:
print "value is not an integer"
or:
c=raw_input("yo: ")
if c in '0123456789':
print "integer"
else:
print "char"
or some other way?
--
http://mail.python.org/mailman/listinfo/python-list
