|
#!/bin/env python
# -*- coding: utf-8 -*-
# python startup file
import sys
import readline
import rlcompleter
import atexit
import os
import platform
# tab completion
readline.parse_and_bind('tab: complete')
## 此为增加历史命令记录到文件,在各自的家目录下,如果不需要记录日志可删除
if platform.system() == 'Windows':
# history file ,os.environ获取用户的家目录,此为win10的,win7系统可能需要改下(自己看下os.environ的key)
histfile = os.path.join(os.environ['USERPROFILE'], '.pythonhistory')
else:
# history file ,os.environ获取用户的家目录
histfile = os.path.join(os.environ['HOME'], '.pythonhistory')
## end for history###
try:
readline.read_history_file(histfile)
except IOError:
pass
atexit.register(readline.write_history_file, histfile)
del os, histfile, readline, rlcompleter |
|
|