About 12,900,000 results
Open links in new tab
  1. python - How can I read inputs as numbers? - Stack Overflow

    Dec 8, 2013 · Python 2.x There were two functions to get user input, called input and raw_input. The difference between them is, raw_input doesn't evaluate the data and returns as it is, in string form. …

  2. python - Creating if/else statements dependent on user input - Stack ...

    I'm trying to create a simple script that will will ask a question to which the user will input an answer (Or a prompt with selectable answers could appear?), and the program would output a response based on …

  3. python - How to read keyboard input? - Stack Overflow

    As blocking on keyboard input (since the input() function blocks) is frequently not what we want to do (we'd frequently like to keep doing other stuff), here's a very-stripped-down multi-threaded example …

  4. Why do I get "NameError: name '...' is not defined ... - Stack Overflow

    TL;DR input function in Python 2.7, evaluates whatever your enter, as a Python expression. If you simply want to read strings, then use raw_input function in Python 2.7, which will not evaluate the read …

  5. How do I do simple user input in python? - Stack Overflow

    25 You can use the input() function to prompt the user for input, and float to convert the user input from a string to a float:

  6. How to define default value if empty user input in Python?

    Here I have to set the default value if the user will enter the value from the keyboard. Here is the code that user can enter value: input = int(raw_input("Enter the inputs : ")) Here the value wi...

  7. How do I use raw_input in Python 3? - Stack Overflow

    Jun 5, 2009 · I'm learning python as well and found one difference between input() and raw_input(). a = input() will take the user input and put it in the correct type. Eg: if user types 5 then the value in a is …

  8. python - Getting user input - Stack Overflow

    In Python 3, it's just input() - caution : there is an input method in 2.x too, but it eval ()s the input and is therefore evil.

  9. python - How to redo an input if user enters invalid answer - Stack ...

    Closed last year. I'm new to programming, and I was wondering how I can repeat an input section, if the user types in invalid data. I want the application to just repeat the input section, instead of having to …

  10. python - What's the simplest way of detecting keyboard input in a ...

    Well, since the date of this question post, a Python library addressed this topic. pynput library, from Moses Palmer, is GREAT to catch keyboard and mouse events in a very simple way.