Questions tagged [raw-input]

The raw input API provides a stable and robust way for applications to accept raw input from any HID (Human Interface Devices), including the keyboard and mouse.

606 questions
55
votes
7 answers

How to set a default editable string for raw_input?

I'm using Python 2.7's raw_input to read from stdin. I want to let the user change a given default string. Code: i = raw_input("Please enter name:") Console: Please enter name: Jack The user should be presented with Jack but can change (backspace)…
ifschleife
  • 985
  • 1
  • 8
  • 20
50
votes
2 answers

Tab completion in Python's raw_input()

i know i can do this to get the effect of tab completion in python sure. import readline COMMANDS = ['extra', 'extension', 'stuff', 'errors', 'email', 'foobar', 'foo'] def complete(text, state): for cmd in COMMANDS: if…
John Riselvato
  • 12,403
  • 5
  • 58
  • 87
49
votes
1 answer

Raw_Input() Is Not Defined

I'm a seventh grade programmer so I may be missing a lot of things in this program, but for my coding club my instructor asked us to make a guess the number game. I have very limited knowledge on this subject, since I've only attended four classes.…
Makailah Morris
  • 501
  • 1
  • 4
  • 3
46
votes
6 answers

Use of input/raw_input in python 2 and 3

I would like to set a user prompt with the following question: save_flag is not set to 1; data will not be saved. Press enter to continue. input() works in python3 but not python2. raw_input() works in python2 but not python3. Is there a way to do…
218
  • 1,574
  • 4
  • 23
  • 34
35
votes
4 answers

raw_input and timeout

I want to do a raw_input('Enter something: .'). I want it to sleep for 3 seconds and if there's no input, then cancel the prompt and run the rest of the code. Then the code loops and implements the raw_input again. I also want it to break if the…
ykmizu
  • 391
  • 1
  • 4
  • 7
24
votes
4 answers

Backwards-compatible input calls in Python

I was wondering if anyone has suggestions for writing a backwards-compatible input() call for retrieving a filepath? In Python 2.x, raw_input worked fine for input like /path/to/file. Using input works fine in this case for 3.x, but complains in 2.x…
Keith Hughitt
  • 4,233
  • 5
  • 40
  • 50
22
votes
7 answers

How to set time limit on raw_input

in python, is there a way to, while waiting for a user input, count time so that after, say 30 seconds, the raw_input() function is automatically skipped?
calccrypto
  • 7,651
  • 19
  • 63
  • 96
22
votes
1 answer

Hiding raw_input() password input

I want to hide my password but I don't know how. I have seen show="*" and also getpass but I don't know how to place them into this code. I'm using Python 2.7.3 and coding on a Raspberry Pi. ans = True while ans: print(""" …
Steven Sharman
  • 251
  • 1
  • 2
  • 7
16
votes
3 answers

What is the proper way to take a directory path as user input?

Below is a snippet of code I am trying to use to take a directory path as "raw input" from the user. I receive the following error after the input is taken from the user: Traceback (most recent call last): File…
mrokeowo
  • 183
  • 1
  • 1
  • 5
16
votes
5 answers

How do I check if raw input is integer in python 2.7?

Is there a method that I can use to check if a raw_input is an integer? I found this method after researching in the web: print isinstance(raw_input("number: ")), int) but when I run it and input 4 for example, I get FALSE. I'm kind of new to…
Alejandro Veintimilla
  • 8,140
  • 19
  • 74
  • 155
13
votes
6 answers

User input with a timeout, in a loop

I'm trying to create a looping python function which performs a task and prompts the user for a response and if the user does not respond in the given time the sequence will repeat. This is loosely based off this question: How to set time limit on…
user3374113
  • 433
  • 1
  • 6
  • 18
13
votes
2 answers

How to get Coordinates of Touchscreen Rawdata using Linux

We have a 3m microtouch display. It's connected to my Debian system via USB and recognized as human interface (hid). I am trying to access and push realtime information... if its getting touched I want to know where (x,y) and pipe it through netcat…
uncle_iroh
  • 173
  • 1
  • 2
  • 7
13
votes
4 answers

How to make a list from a raw_input in python?

So I am taking raw_input as an input for some list. x= raw_input() Where I input 1 2 3 4 How will I convert it into a list of integers if I am inputting only numbers?
user3481478
  • 387
  • 1
  • 3
  • 15
11
votes
6 answers

Masking user input in python with asterisks

I am trying to mask what the user types into IDLE with asterisks so people around them can't see what they're typing/have typed in. I'm using basic raw input to collect what they type. key = raw_input('Password :: ') Ideal IDLE prompt after user…
Jackson Blankenship
  • 445
  • 2
  • 7
  • 17
11
votes
4 answers

Reading input from raw_input() without having the prompt overwritten by other threads in Python

I'm trying to let the user input commands at a console using raw_input(), this works fine. The problem is I have background threads that occasionally output log-information to the screen and when they do they mess up the input prompt (since the…
Jim
  • 113
  • 1
  • 1
  • 6
1
2 3
40 41