Python中的Tab补全功能添加
用 Python shell 没有 Tab 补全还是挺痛苦的,下面就记录一下如何补全:
1. 先准备一个 tab.py 的脚本。
>>> tap.py
#!/usr/bin/python # python tab file import sys 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. 查看Python默认的模块存放地址
Python 3.6.3 (v3.6.3:2c5fef8, Oct 3 2017, 18:22:56) [MSG v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import string >>> string .__file__ 'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\string.py'
3. 拷贝该脚本到默认模块存放路径
>>> 'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\'
4. 现在可以用了.hhhhhhhhhhh
相关推荐
huavhuahua 2020-11-20
weiiron 2020-11-16
cakecc00 2020-11-15
千锋 2020-11-15
JakobHu 2020-11-14
guangcheng 2020-11-13
xirongxudlut 2020-11-10
solarLan 2020-11-09
pythonxuexi 2020-11-08
文山羊 2020-11-07
susmote 2020-11-07
wuShiJingZuo 2020-11-05
Pythonjeff远 2020-11-06
jacktangj 2020-11-04
lousir 2020-11-04
Noneyes 2020-11-10
ailxxiaoli 2020-11-16
chensen 2020-11-14
Nostalgiachild 2020-11-13