Created
July 13, 2018 08:30
-
-
Save pavelpy/d60f4b7dd75b176c9eddf66f39e8da13 to your computer and use it in GitHub Desktop.
export PYTHONSTARTUP=$HOME/.python-startup.py
This file contains 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 os | |
import readline | |
import rlcompleter | |
import atexit | |
history_file = os.path.join(os.environ['HOME'], '.python_history') | |
try: | |
readline.read_history_file(history_file) | |
except IOError: | |
pass | |
# Turn on Autocomplete | |
readline.parse_and_bind("tab: complete") | |
# Limit the number of entries saved | |
readline.set_history_length(1000) | |
# Create history file on exit if it doesn't already exist | |
atexit.register(readline.write_history_file, history_file) | |
# Remove all variables | |
del os, readline, rlcompleter, atexit, history_file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment