How to read keyboard-input?

Use

input('Enter your input:')

if you use Python 3.

And if you want to have a numeric value, just convert it:

try:
    mode = int(input('Input:'))
except ValueError:
    print("Not a number")

If you use Python 2, you need to use raw_input instead of input.

Leave a Comment