摘要:本文主要向大家介绍了Python语言 自动补全模块,通过具体的内容向大家展示,希望对大家学习Python语言有所帮助。
本文主要向大家介绍了Python语言 自动补全模块,通过具体的内容向大家展示,希望对大家学习Python语言有所帮助。
for linux#!/usr/bin/env python # python startup file import sysimport readlineimport rlcompleterimport atexitimport 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: passatexit.register(readline.write_history_file, histfile)del os, histfile, readline, rlcompleter把上面代码保存为tab.py放置在当前系统全局环境变量下,可以使用print(sys.path)查看,如:/usr/lib64/python2.6/site-packagesfor macimport sysimport readlineimport rlcompleterif sys.platform == 'darwin' and sys.version_info[0] == 2: readline.parse_and_bind("bind ^I rl_complete")else: readline.parse_and_bind("tab: complete") # linux and python3 on macfor mac
以上就介绍了Python的相关知识,希望对Python有兴趣的朋友有所帮助。了解更多内容,请关注职坐标编程语言Python频道!
您输入的评论内容中包含违禁敏感词
我知道了
请输入正确的手机号码
请输入正确的验证码
您今天的短信下发次数太多了,明天再试试吧!
我们会在第一时间安排职业规划师联系您!
您也可以联系我们的职业规划师咨询:
版权所有 职坐标-一站式IT培训就业服务领导者 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
沪公网安备 31011502005948号