Created
August 23, 2015 00:26
-
-
Save mbdevpl/ed9a64eed9903cc43286 to your computer and use it in GitHub Desktop.
Non-working solution for http://stackoverflow.com/q/30193945/4973698
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
# attempt for: | |
# http://stackoverflow.com/q/30193945/4973698 | |
# | |
# Do `pip install pyreadline` and run this script. | |
# | |
# Unfortunately, it does not work! | |
import readline | |
def input_def2(prompt, default=''): | |
readline.set_startup_hook(lambda: readline.insert_text(default)) | |
try: | |
return input(prompt) | |
finally: | |
readline.set_startup_hook() | |
if __name__ == '__main__': | |
name = input_def2('Folder name: ', 'it works!!!') | |
print() | |
print(name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment