Re: python2 input
On Fri, May 3, 2013 at 5:16 PM, dabaichi <email@example.com> wrote:
> Hello guys:
> Do you have found that the built-in input() function is dangerous.
> Here is my code(python 2.x only):
> a = input("Input anything:")
> print("go here")
> If I input:
> print("go here") will not be execute, and the script will exit.
Yeah, that's kinda discovered. In Python 2, you should be using
raw_input() for that kind of thing. In Python 3, raw_input() was
renamed to input(), and if you want the semantics of Py2 input(), it's
eval(input()), which makes it obvious what's going on.
|All times are GMT. The time now is 07:28 AM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.