Persistent Python Command-Line History

前端 未结 5 856
灰色年华
灰色年华 2021-02-04 07:29

I\'d like to be able to \"up-arrow\" to commands that I input in a previous Python interpreter. I have found the readline module which offers functions like:

5条回答
  •  忘掉有多难
    2021-02-04 08:25

    I think the suggestions in the Python documentation pretty much cover what you want. Look at the example pystartup file toward the end of section 13.3:

    • http://docs.python.org/tutorial/interactive.html

    or see this page:

    • http://rc98.net/pystartup

    But, for an out of the box interactive shell that provides all this and more, take a look at using IPython:

    • http://ipython.scipy.org/moin/

提交回复
热议问题