daily pastebin goal
2%
SHARE
TWEET

Untitled

a guest Feb 23rd, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Add auto-completion and a stored history file of commands to your Python
  2. # interactive interpreter. Requires Python 2.0+, readline. Autocomplete is
  3. # bound to the Esc key by default (you can change it - see readline docs).
  4. #
  5. # Store the file in ~/.pystartup, and set an environment variable to point
  6. # to it:  "export PYTHONSTARTUP=~/.pystartup" in bash.
  7.  
  8. import atexit
  9. import os
  10. import readline
  11. import rlcompleter
  12.  
  13. historyPath = os.path.expanduser("~/.pyhistory")
  14.  
  15. def save_history(historyPath=historyPath):
  16.     import readline
  17.     readline.write_history_file(historyPath)
  18.  
  19. if os.path.exists(historyPath):
  20.     readline.read_history_file(historyPath)
  21.  
  22. atexit.register(save_history)
  23. del os, atexit, readline, rlcompleter, save_history, historyPath
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top