Created
February 26, 2009 22:53
-
-
Save stephenroller/71179 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import readline | |
def make_hook(text): | |
def _hook(): | |
readline.insert_text(text) | |
readline.redisplay() | |
return _hook | |
readline.set_pre_input_hook(make_hook('')) | |
while True: | |
line = raw_input('> ') | |
if line == "quit": | |
break | |
readline.set_pre_input_hook(make_hook(line)) | |
print "you entered '%s'" % line |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment