Chitrank Dixit Chitrank Dixit - 1 year ago 64
Python Question

raw_input("") has been eliminated from python 3.2

I have tried a lot to run

raw_input("")
on the python console but that gives an error. Moreover I watch some videos that might have been made on old python. so
input("")
is the only method and why
raw_input("")
is discarded in the new version is there any reason ?

Answer Source

raw_input() was renamed to input() in Python v3.x

The old input() is gone, but you can emulate it with eval(input())

What's new in Python 3 will mention this (and more):

PEP 3111: raw_input() was renamed to input(). That is, the new input() function reads a line from sys.stdin and returns it with the trailing newline stripped. It raises EOFError if the input is terminated prematurely. To get the old behavior of input(), use eval(input()).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download