27 lines
533 B
Plaintext
27 lines
533 B
Plaintext
import sys
|
|
import os
|
|
import atexit
|
|
import readline
|
|
|
|
histfile = os.path.expanduser('~/.pythonhistory')
|
|
try:
|
|
readline.read_history_file(histfile)
|
|
except IOError:
|
|
pass
|
|
def write_history(readline=readline, histfile=histfile):
|
|
try:
|
|
readline.write_history_file(histfile)
|
|
except IOError:
|
|
pass
|
|
atexit.register(write_history)
|
|
|
|
|
|
if sys.version_info.major == 3:
|
|
sys.ps1 = "3>>> "
|
|
sys.ps2 = "3... "
|
|
else:
|
|
sys.ps1 = "2>>> "
|
|
sys.ps2 = "2... "
|
|
|
|
del readline, histfile, atexit, write_history, sys, os
|