Python Forum
Going thru tutorials..."NameError: name 'raw_input' is not defined" - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Going thru tutorials..."NameError: name 'raw_input' is not defined" (/thread-28312.html)



Going thru tutorials..."NameError: name 'raw_input' is not defined" - hmonnier - Jul-13-2020

I'm a total newbie, wrote machine code for years at GE, Digital Communications stuff. Off to try to learn Python.
In going thru the tutorials in one of the 'dummies' books, they have an example using raw_input(), and I get this error message
Error:
"NameError: name 'raw_input' is not defined"
now I presume i have not loaded some needed library. I downloaded and installed python 3.8, is there something else I must do?
Thanks, Henri Monnier


RE: Going thru tutorials... - Yoriz - Jul-13-2020

The tutorial you have is out of date, it is for python2.
input is used in python3 in place of raw_input.


RE: Going thru tutorials... - hmonnier - Jul-14-2020

(Jul-13-2020, 09:39 PM)Yoriz Wrote: The tutorial you have is out of date, it is for python2.
input is used in python3 in place of raw_input.

Yoriz,
Is there a list that helps a newbie like me to be aware of the changes betwixt version 2 and 3. That would be a GREAT help for those of us that are trying to learn.
Thanks..... Henri Monnier...


RE: Going thru tutorials..."NameError: name 'raw_input' is not defined" - Yoriz - Jul-14-2020

See
Should I use Python 2 or Python 3 for my development activity?
and the previous version of this page
Should I use Python 2 or Python 3 for my development activity?


RE: Going thru tutorials..."NameError: name 'raw_input' is not defined" - BitPythoner - Jul-14-2020

NOTE: Python 2 might be simpler in some respects, but now that more people are transferring to python 3,
you might need to use python 3 in order to better comprehend code.
I am also aware some changes in Try and Except statements.