input string in python 3 -


i have string variable test, in python 2.7 works fine.

test = raw_input("enter test") print test 

but in python 3.3. use

test = input("enter test") print test 

with input string sdas, , error message

traceback (most recent call last): file "/home/ananiev/pycharmprojects/piglatin/main.py", line 5, in test = input("enter test") file "", line 1, in nameerror: name 'sdas' not defined

you're running python 3 code python 2 interpreter. if weren't, print statement throw syntaxerror before ever prompted input.

the result you're using python 2's input, tries eval input (presumably sdas), finds it's invalid python, , dies.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -