How do I use raw_input in Python 3 How do I use raw_input in Python 3 python python

How do I use raw_input in Python 3


Starting with Python 3, raw_input() was renamed to input().

From What’s New In Python 3.0, Builtins section second item.


This works in Python 3.x and 2.x:

# Fix Python 2.x.try: input = raw_inputexcept NameError: passprint("Hi " + input("Say something: "))


A reliable way to address this is

from six.moves import input

six is a module which patches over many of the 2/3 common code base pain points.


matomo