Windows下Python tab键补全

作者: 指间_流年 | 来源:发表于2017-10-24 15:58 被阅读41次

    ###打开CMD,安装readline模块###

    Python -m pip install pyreadline

    ###在C:\Python27\Lib下新建tab.py文件,内容如下###

    #python Tab

    import sys

    import readline

    import rlcompleter

    import atexit

    import os

    readline.parse_and_bind('tab: complete')

    # windows

    histfile = os.path.join(os.environ['HOMEPATH'], '.pythonhistory')

    # linux

    # 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

    相关文章

      网友评论

        本文标题:Windows下Python tab键补全

        本文链接:https://www.haomeiwen.com/subject/diqxpxtx.html