Tab completion in Python interpreter

less than 1 minute read

You can achieve auto completion inside Python interpreter by adding the following lines to your .pythonrc file (or the file you have set Python to read on startup using PYTHONSTARTUP environment variable):

>>>import rlcompleter, readline
>>>readline.parse_and_bind(tab: complete)

This will make Python complete partially typed function, method and variable names when you press the tab key. You can also set the prompts sys.ps1 and sys.ps2 in this file.

Categories:

Updated: