English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The input() method reads a line from input, converts it to a string and returns it.
The syntax of input() method is:
input([prompt])
The input() method takes an optional parameter:
prompt (optional) -Write a string to standard output (usually the screen) without a newline character
The input() method reads a line from input (usually user input), converts it to a string by removing the trailing newline character, and then returns it.
If EOF is read, EOFError exception will be raised.
# Get user input inputString = input() print('The input string is:', inputString)
When running the program, the output is:
fr.oldtoolbag.com The input string is: fr.oldtoolbag.com
# Get user input inputString = input('Input string:') print('The input string is:', inputString)
When running the program, the output is:
Input string: fr.oldtoolbag.com Python basic tutorial The input string is: fr.oldtoolbag.com Python basic tutorial