Hello. I was wondering if it was possible to have a input be both a raw_input and an input so that way errors are not causes if the following happened:
As a rule you should only use raw_input. If you require a number than you are able to verify via string methods as in the following example.
[code=python]def check_numeric(i np):
if inp.isdigit():
print "Thank you for entering %s" % inp
else:
print "Your input of %s is not a number :(" % inp
>>> usr_inp = raw_input("Ente r a number: ")
Enter a number: 55
>>> check_numeric(u sr_inp)
Thank you for entering 55
>>> usr_inp = raw_input("Ente r a number: ")
Enter a number: blah
>>> check_numeric(u sr_inp)
Your input of blah is not a number :(
>>> [/code]
Comment