Categories
Python Answers

How to save a Python interactive session?

Spread the love

Sometimes, we want to save a Python interactive session.

In this article, we’ll look at how to save a Python interactive session.

How to save a Python interactive session?

To save a Python interactive session, we can use the readline module.

For instance, we write

import readline

readline.write_history_file('/home/ahj/history')

to call readline.write_history_file to save the interactive session content into the /home/ahj/history file.

Conclusion

To save a Python interactive session, we can use the readline module.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *