code_junkie

How do I add tab completion to the Python shell?

Nov 12th, 2011
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. Python 2.5.1 (r251:54863, Apr 15 2008, 22:57:26)
  2. [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
  3. Type "help", "copyright", "credits" or "license" for more information.
  4. (InteractiveConsole)
  5.  
  6. # ~/.pythonrc
  7. # enable syntax completion
  8. try:
  9. import readline
  10. except ImportError:
  11. print "Module readline not available."
  12. else:
  13. import rlcompleter
  14. readline.parse_and_bind("tab: complete")
  15.  
  16. export PYTHONSTARTUP=~/.pythonrc
Add Comment
Please, Sign In to add comment