Last Updated: February 25, 2016
·
2.515K
· ericmarcos

Python console tab autocomplete

It just takes 4 lines of code to enhance the good old python console with tab autocompletion (just like in IPython):

import readline
import rlcompleter
readline.set_completer(rlcompleter.Completer(imported_objects).complete)
readline.parse_and_bind("tab:complete")

* (tested in Python 2.7)

** (borrowed from django's shell command source code)

1 Response
Add your response

...and the variable 'imported_objects'? Where does it come from?

over 1 year ago ·