How can I get the last raw_input? My py asks questions(raw_input) and if user types wrong asks the same again and user needs to type all over again, so how can I get last input to make de user just edit it??(like a shell pressing key-up)
2
There are 2 best solutions below
0
user2357112
On
Use the readline module.
import readline
# Everything magically works now!
There are more sophisticated features available if you want tab completion and other goodies.
Related Questions in PYTHON
- new thread blocks main thread
- Extracting viewCount & SubscriberCount from YouTube API V3 for a given channel, where channelID does not equal userID
- Display images on Django Template Site
- Difference between list() and dict() with generators
- How can I serialize a numpy array while preserving matrix dimensions?
- Protractor did not run properly when using browser.wait, msg: "Wait timed out after XXXms"
- Why is my program adding int as string (4+7 = 47)?
- store numpy array in mysql
- how to omit the less frequent words from a dictionary in python?
- Update a text file with ( new words+ \n ) after the words is appended into a list
- python how to write list of lists to file
- Removing URL features from tokens in NLTK
- Optimizing for Social Leaderboards
- Python : Get size of string in bytes
- What is the code of the sorted function?
Related Questions in INPUT
- Trying to set the value of an input with mechanize
- Extract value of a input hidden DOMXpath php
- If Input is focused trigger X else trigger Y
- When in click a radio button, it scroll to the top. How to prenvent that?
- Numeric Keyboard display using HTML input type
- how to get user to pick inputs Java
- Input cursor windows phone phonegap
- C++ cin can't read in integers with 0 in them
- Phonegap VideoPlayer Plugin Sample Code
- Input Autofocus on type
- Why this JavaScript code does not work?
- How to input a value that has a unit as "per something"?
- Is there a standard way to capture keyboard inputs that works in a c++ application for linux and windows?
- Disable or Enable buttons based on some conditions
- How to get keystrokes with java outside of frames
Related Questions in RAW-INPUT
- User input filename when reading in netCDF files in Python
- Python - raw input not recognising mathematical processes
- SyntaxError: 'break' outside loop in python code
- raw_input multiple inputs around strings
- Using raw_input causes problems with PyQt page loading
- Need help in entering integers into python and more
- Python script with input not running unless I execute it on terminal
- Add missing dictionary key/value via raw_input
- how can i input multiple numbers or strings only at once to append them to a list?
- python raw_input after sys.stdin read
- How can I make a raw_input choice based on a list provided give me a correct result when chosen?
- How to prevent a keyboard from writing to other applications
- How convert easily vkeys ALT Combination to text?
- How to make the raw_input prompt automatically read a string from a previous list?
- how to use a raw_input as argument in a function in python 3
Related Questions in REPLAY
- jetty replay request on timeout
- How do I replay a game?
- Asp.Net forms authentication replay attack
- How to prevent cross site forgery attack (replay attack) in .NET 4.0 MVC web application by using Antiforgery Technique
- Replaying SQL Server Trace for SqlBulkCopy Command
- Maintaining mirrored database of a MongoDB replica set
- ReplayBloc function onTransition() handles event _Undo instead of user defined event
- error of function replay in DolphinDB: inputTables must be one or a tuple of non segmented tables|DataSources
- Replaying CSS Animations
- AxonIQ process new events while replaying older ones
- Remove item from Replay Observable
- Python user input replay
- How to detect the end of replay in Kinect Toolbox
- Wicket link replay attack
- How to secure real-world load-balanced WCF service against replay attacks
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You are looking for the
readlinemodule. Here's an example from effbot.org: