How do I add tab completion to the Python shell?

后端 未结 9 850
甜味超标
甜味超标 2020-11-30 16:41

When starting a django application using python manage.py shell, I get an InteractiveConsole shell - I can use tab completion, etc.

Python 2.5.1         


        
相关标签:
9条回答
  • 2020-11-30 17:30

    It looks like python3 has it out-of box!

    0 讨论(0)
  • 2020-11-30 17:32

    For the record, this is covered in the tutorial: http://docs.python.org/tutorial/interactive.html

    0 讨论(0)
  • 2020-11-30 17:36

    I use ptpython - it is a wonderful tool autocomplete shell cmd.

    Installing ptpython is very easy, use pip tool

    pip install ptpython
    

    and for django shell, you should import the django env, like this

    import os
    
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "testweb.settings")
    

    Trust me, this is the best way for you!!!

    0 讨论(0)
提交回复
热议问题