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
.
More Related Contents:
- How to convert a string to integer entered in input functon? [duplicate]
- How can I read inputs as numbers?
- input() error – NameError: name ‘…’ is not defined
- How to get keyboard input in pygame?
- What’s the difference between `raw_input()` and `input()` in Python 3?
- How to read a single character from the user?
- Sending data from HTML form to a Python script in Flask
- How to check if string input is a number?
- How to delete a specific line in a file?
- Can’t send input to running program in Sublime Text
- How to prompt for user input and read command-line arguments [closed]
- Non-blocking console input?
- Polling the keyboard (detect a keypress) in python
- What’s the simplest way of detecting keyboard input in a script from the terminal?
- How do you input integers using input in Python
- print statement inside of input returns with a “none”
- How to test a function with input call?
- Finding the Values of the Arrow Keys in Python: Why are they triples?
- How to read an array of integers from single line of input in python3
- Detect in python which keys are pressed
- Prompt the user to input something else if the first input is invalid [duplicate]
- How do I do simple user input in python? [duplicate]
- How do I ‘lock the keyboard’ to prevent any more keypresses being sent on X11/Linux/Gnome?
- Command-line input causes SyntaxError
- Validating user input strings in Python
- How to finish sys.stdin.readlines() input?
- How to obtain the keycodes in Python
- win32: simulate a click without simulating mouse movement?
- Python: How to get input from console while an infinite loop is running?
- Playing mp3 file through microphone with python