On this page
input
Prev: id | Up: __builtins__ | Next: int
Rel: breakpoint, compile, eval, exec, globals
Ref: docs.python.org — input
Tags: #public #python3 #builtins
Import & Availability
# Built-in (available globally without import)
from builtins import input
Overview & Signature
input(prompt='', /)
Read a string from standard input. The trailing newline is stripped.
Usage
# Reads one line from sys.stdin as a str (trailing newline stripped):
# name = input("Name: ")
assert callable(input)
Gotchas
- Always returns
str: Convert numeric input withint()/float()insidetry/except ValueError, and handleEOFErroron piped input.
REPL Inspect
help(input)
Linked from
- tuts/python3/__builtins__
- tuts/python3/__builtins__/__builtins__
- tuts/python3/__builtins__/breakpoint
- tuts/python3/__builtins__/compile
- tuts/python3/__builtins__/eval
- tuts/python3/__builtins__/exec
- tuts/python3/__builtins__/globals
- tuts/python3/__builtins__/id
- tuts/python3/__builtins__/int
- tuts/python3/tutorials/core_fundamentals/syntax_and_variables
Related notes
- tuts/python3/__builtins__/__builtins__ Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/breakpoint Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/compile Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/eval Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/exec Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/globals Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/id Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/int Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__ links to this page; shared tags: #builtins
- tuts/python3/tutorials/core_fundamentals/syntax_and_variables links to this page