首页 > 编程语言 > 详细

设置python中TAB键自动补全方法

时间:2017-08-21 00:00:46      阅读:518      评论:0      收藏:0      [点我收藏+]

设置python中TAB键自动补全方法


一、创建自动补全脚本如下:

vi /tmp/python/tab.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

二、导入上面创建的模块

#python

>>>import sys

>>>sys.path.append(‘/tmp/python/‘)

>>>import tab

#之后便可利用TAB补全了

本文出自 “银河系|计算机网络” 博客,请务必保留此出处http://qqran.blog.51cto.com/10014850/1957881

设置python中TAB键自动补全方法

原文:http://qqran.blog.51cto.com/10014850/1957881

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!