发布时间:2019-08-28 09:06:39编辑:auto阅读(1834)
首先在家目录下创建一个隐藏文件,vi ~/.pythonstartup,内容如下:
# python startup file
import readline
import rlcompleter
import atexit
import os
# tab completion
readline.parse_and_bind('tab:complete')
# history file
histfile = os.path.join(os.environ['HOME'],'.pythonhistory')
try:
readline.read_history_file(histfile)
except IOError:
pass
atexit.register(readline.write_history_file,histfile)
del os,histfile,readline,rlcompleter
2.设置bash环境变量:
vi /root/.bash_profile
在文件的最后加入一句:
export PYTHONSTARTUP=~/.pythonstartup
3.重启计算机,reboot,然后就可以使用tab键的自动补全功能了。
上一篇: Python算法题----逆序列表
下一篇: Python 中有关中文编码解码小记
49402
48603
39295
36378
30783
27600
26590
21411
21275
19621
272°
522°
492°
596°
1001°
668°
1355°
1593°
1262°
1242°