Syntax

Python Read User Input Syntax

In Python, read user input: reads a line of text typed by the user — name = input("Name: ")

Quick Answer

Syntax
name = input("Name: ")
PythonSyntax

Read User Input

Code example
name = input("Name: ")

Reads a line of text typed by the user.

Learn More

How to read user input in Python

  1. Open your Python file or editor.
  2. Copy the example, then replace its sample names and values for your code.

Python Read User Input Syntax

Use name = input("Name: ").

Related Syntax References

Frequently asked questions

What is the Python syntax for read user input?

Use this pattern: name = input("Name: ")

Can I copy this Python code example?

Yes. Use Copy code and adapt the example to your program.

Is this Python syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify