About 268,000 results
Open links in new tab
  1. 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 …

  2. python - Getting user input - Stack Overflow

    Since you're just beginning in Python, it might be a good idea to look through a tutorial and learn the basics of the language, rather than try to learn just the features you need and search for …

  3. python - How to detect key presses? - Stack Overflow

    I am making a stopwatch type program in Python and I would like to know how to detect if a key is pressed (such as p for pause and s for stop), and I would not like it to be something like …

  4. python - How can I read inputs as numbers? - Stack Overflow

    Dec 8, 2013 · The best way is to enter the entire string of numbers line by line and split them into integers. Here is the Python 3 version: a = [] p = input() p = p.split() for i in p: a.append(int(i)) …

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

    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 …

  6. python - How do I access command line arguments? - Stack …

    To get only the command line arguments (not including the name of the Python file) import sys sys.argv[1:] The [1:] is a slice starting from the second element (index 1) and going to the end …

  7. python - How do I read from stdin? - Stack Overflow

    Sep 20, 2009 · In Python 2, this is raw_input(prompt). open(0).read() - In Python 3, the builtin function open accepts file descriptors (integers representing operating system IO resources), …

  8. User input boolean in python - Stack Overflow

    Feb 15, 2018 · I am trying to have a user input whether or not they like spicy food and the output is supposed to be a boolean but I don't seem to be getting an output with my code below: def …

  9. 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.

  10. Asking the user for input until they give a valid response

    Apr 25, 2014 · You can make the input statement a while True loop so it repeatedly asks for the users input and then break that loop if the user enters the response you would like.

Refresh