首页 > 编程语言 > 详细

Python交互模式下代码自动补全

时间:2017-01-11 22:16:28      阅读:382      评论:0      收藏:0      [点我收藏+]

这个功能是以lib的形式提供的,配置写到home下的.pythonrc文件中, 并设置好环境变量让python启动时执行初始化:

# ~/.pythonrc
# enable syntax completion

# add the next line to your ~/.bashrc
# export PYTHONSTARTUP=~/.pythonrc
try:
    import readline
except ImportError:
    print("Module readline not available.")
else:
    import rlcompleter
    readline.parse_and_bind("tab: complete")
    readline.parse_and_bind(‘‘‘control-l:"    "‘‘‘)

最后一行是绑定control和"L"健,自动补四个空格作缩进。因为tab键已经被征用了,所以只能用其它组合健作缩进。

Python交互模式下代码自动补全

原文:http://www.cnblogs.com/hyang0/p/py_complete.html

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