Skip to content

Instantly share code, notes, and snippets.

Forked from matterche/.pystartup
Created Sep 20, 2017
What would you like to do?
Enable Python REPL command history and tab completion
# Store this file in ~/.pystartup,
# set "export PYTHONSTARTUP=/home/user/.pystartup"
# Note that PYTHONSTARTUP does *not* expand "~", so you have to put in the
# full path to your home directory.
import atexit
import os
import readline
import rlcompleter
readline.parse_and_bind('tab: complete')
historyPath = os.path.expanduser("~/.pyhistory")
def save_history(historyPath=historyPath):
import readline
if os.path.exists(historyPath):
del os, atexit, readline, rlcompleter, save_history, historyPath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment