[Tutor] dangers of input() (original) (raw)
Danny Yoo dyoo at hkn.eecs.berkeley.edu
Tue Jul 20 20:05:54 CEST 2004
- Previous message: [Tutor] dangers of input()
- Next message: [Tutor] dangers of input()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, 20 Jul 2004, Dick Moores wrote:
I was thinking of using input() instead of rawinput 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.
Hi Dick,
Yup, that's right:
value = input("enter an expression: ") enter an expression: 23 + 42 + 3**1 value 27
value = rawinput("enter an expression: ") enter an expression: 23 + 42 + 31 value '23 + 42 + 31' ###
Hope this helps!
- Previous message: [Tutor] dangers of input()
- Next message: [Tutor] dangers of input()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]