[Tutor] dangers of input() (original) (raw)

Dick Moores rdm at rcblue.com
Tue Jul 20 13:25:30 CEST 2004


Alan Gauld wrote at 15:13 7/19/2004:

The other wee point is that input() is not recommended because Python literally evaluates the user input which could be a malicious python command! Better to use rawinput and convert to an int or float.

The above is from another thread.

I was thinking of using input() instead of raw_input in my Frac.py (posted yesterday). This would enable the user to enter things such as "4**-3". Am I correct in assuming that this would be impossible to do without using input()? If so, I may go ahead with input()--I'm the only user, after all.

Dick Moores



More information about the Tutor mailing list