Name
input
Synopsis
input(prompt
='')
input(
prompt
)
is a shortcut for
eval(raw_input(
prompt
))
.
In other words, input
prompts the user for a line
of input, evaluates the resulting string as an expression, and
returns the expression’s result. The implicit
eval
may raise SyntaxError
or
other exceptions. input
is therefore rather
user-unfriendly and not appropriate for most programs, but it can be
handy for experiments and your own test scripts. See also
eval and raw_input in this
section.
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.