Skip to content

Instantly share code, notes, and snippets.

@lmlsna
Created November 4, 2017 11:27
Show Gist options
  • Save lmlsna/f1ad87e0af26ec099ff23946962a8c46 to your computer and use it in GitHub Desktop.
Save lmlsna/f1ad87e0af26ec099ff23946962a8c46 to your computer and use it in GitHub Desktop.
Enable tab completion in an interactive python2 shell
'''
This script enables tab competion for functions in the Python2 interactive shell.
It requires the readline and rlcompleter packages (install with pip) and set PYTHONSTARTUP
to this file's location as an enironmental variable in your .bashrc file.
'''
try:
import readline
except ImportError:
pass
else:
import rlcompleter
readline.parse_and_bind("tab: complete")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment