Skip to content

Instantly share code, notes, and snippets.

@gcmurphy
Created September 22, 2013 23:31
Show Gist options
  • Select an option

  • Save gcmurphy/6664880 to your computer and use it in GitHub Desktop.

Select an option

Save gcmurphy/6664880 to your computer and use it in GitHub Desktop.
# save as ~/.pythonstartup.py
# export PYTHONSTARTUP=$HOME/.pythonstartup.py
# (gives you tab completion / history)
import readline
import rlcompleter
import atexit
import os
readline.parse_and_bind('tab: complete')
history = os.path.join(os.environ['HOME'], '.pythonhistory')
try:
readline.read_history_file(history)
except IOError as e:
pass
atexit.register(readline.write_history_file, history)
del os, history, readline, rlcompleter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment