[Tutor] input() and raw_input()

Henry porterh@m-net.arbornet.org
Thu, 8 Feb 2001 11:20:54 -0500 (EST)


I'm taking a number as input from the user and attempting to do a
comparison on it:
 
selection = raw_input('Enter number: ')
if selection < 3:
	print 'Invalid number'
else:
	print 'OK number'

The comparison works using input() but doesn't when using
raw_input() -- it always drops to the 'else:'.  
I was trying to use raw_input() because it was recommended in the
documentation as a safer way to get user input.  What exactly is
raw_input() doing to the input?  Can I still do my comparison using
raw_input()?  Are there some general rules on when to use
input() vs. raw_input()?

Thanks for any help.