我不记得我在哪里得到的它,但我把它放在我的主页中,为 python 的默认 REPL 提供历史记录和制表符补全
$ cat ~/.pythonrcimport os, atexit, readline, rlcompleter
hfile = os.path.join(os.environ['HOME'], '.python_history')
tryreadline.read_history_file(hfile)except IOErrorpass
readline.parse_and_bind('tab: complete')atexit.register(readline.write_history_file, hfile)del atexit, hfile
同意!
作者评论
我不记得我在哪里得到的它,但我把它放在我的主页中,为 python 的默认 REPL 提供历史记录和制表符补全
$ cat ~/.pythonrc
import os, atexit, readline, rlcompleter
hfile = os.path.join(os.environ['HOME'], '.python_history')
try
readline.read_history_file(hfile)
except IOError
pass
readline.parse_and_bind('tab: complete')
atexit.register(readline.write_history_file, hfile)
del atexit, hfile
同意!