Skip to content

Instantly share code, notes, and snippets.

@StuffbyYuki
Created March 6, 2022 05:26
Show Gist options
  • Save StuffbyYuki/9c4d012247902fbc2adf489417d972db to your computer and use it in GitHub Desktop.
Save StuffbyYuki/9c4d012247902fbc2adf489417d972db to your computer and use it in GitHub Desktop.
Python Shell - output history to a file
import readline
import os # don't necessarily need
filePath = os.path.expanduser('~/Downloads/my_history.py') # don't necessarily need
readline.write_history_file(filePath) # don't necessarily need
# or you can simply do
readline.write_history_file('your_file.py')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment