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.
Questions tagged [raw-input]
623 questions
                    
                    61
                    
            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
        
- 1,055
- 1
- 10
- 21
                    59
                    
            votes
                
                1 answer
            
        NameError: name '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
        
- 601
- 1
- 5
- 3
                    57
                    
            votes
                
                5 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,854
- 5
- 62
- 89
                    48
                    
            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,754
- 7
- 27
- 38
                    38
                    
            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
        
- 421
- 1
- 5
- 7
                    27
                    
            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,860
- 5
- 49
- 54
                    24
                    
            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
        
- 8,583
- 21
- 68
- 99
                    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
- 8
                    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
        
- 10,743
- 23
- 91
- 180
                    15
                    
            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
        
- 193
- 1
- 2
- 7
                    14
                    
            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
        
- 475
- 2
- 7
- 19
                    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
        
- 593
- 1
- 7
- 20
                    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
- 19
                    13
                    
            votes
                
                2 answers
            
        Can you remap keys of a specific keyboard?
I've got two keyboards attached to my computer. A normal full-size keyboard and a numeric keypad. I want to "remap" the keys on the numeric keypad, but leave the full keyboard alone. So, when the user presses "5" on the keypad it would get remapped…
         
    
    
        Vilx-
        
- 104,512
- 87
- 279
- 422
                    12
                    
            votes
                
                1 answer
            
        Use os.listdir to show directories only
How can I bring python to only output directories via os.listdir, while specifying which directory to list via raw_input?
What I have:
file_to_search = raw_input("which file to search?\n>")
dirlist=[]
for filename in os.listdir(file_to_search):
  …
         
    
    
        Felix
        
- 123
- 1
- 1
- 5