import readline readline.write_history_file('my_history.py')