Saving Your Python Shell History

Tags:

If you have been using the Python shell and would like to save your commands to a file for reference, just type the following:

>>> import readline
>>> readline.write_history_file("my_history.txt")

If you use a Python IDE like SPE, it will automatically save your history in a tab.

I haven't tried it yet, but check out Moveable Python — you can apparently carry it around on a USB thumb drive.

Average: 4 (2 votes)

Syndicate content