Wait input from keyboard in Python.
Not only Python but also other program, you want it to wait input from keyboard.
Today I will introduce how to receive standard input.
What is standard input ?
Regarding search result, standard input means input device like keyboard.
You can imagine stdin
in C language.
Standard input is a kind of device like keyboard in UNIX environment.
What is standard input ?
Waiting input like below is easy to imagine.
Please input > (blink)
How to wait input in Python
In order to wait input, you can use input
function.
Code
var = input("Please input variable : ") print("Input variable is : {}".format(var))
Once you execute it, it will wait input like below.
Please input variable :
If you input text and push Enter
, program would resume the process.
Please input variable : aaa Input variable is : aaa
In case of input from console, you can use input function.
raw_input was expired in python3.
Receive standard input
Finally
- If you want to wait input from keyboard, you can use
input
function in python.