Skip to content

Instantly share code, notes, and snippets.

@ILightThings
Created March 15, 2021 20:06
Show Gist options
  • Select an option

  • Save ILightThings/fcd7d045ce30698ffd182139e027ebe1 to your computer and use it in GitHub Desktop.

Select an option

Save ILightThings/fcd7d045ce30698ffd182139e027ebe1 to your computer and use it in GitHub Desktop.
Useful for sending variants of the same data over again but needing to edit it slightly.
import readline
def rlinput(prefill):
readline.set_startup_hook(lambda: readline.insert_text(prefill))
try:
return input() # or raw_input in Python 2
finally:
readline.set_startup_hook()
query = ""
while True:
query = rlinput(query)
print(f"The new line is: {query}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment