zoukankan      html  css  js  c++  java
  • python环境下使用tab自动补全命令

    # vim /usr/lib/python2.7/dist-packages/tab.py

    加入如下内容:

    #!/usr/bin/env python 
    # python startup 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
    Python 2.7.3 (default, Aug  1 2012, 05:16:07) 
    [GCC 4.6.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sys
    >>> import tab
    >>> sys.
    sys.__class__(              sys.argv                    sys.hexversion
    sys.__delattr__(            sys.builtin_module_names    sys.long_info
    sys.__dict__                sys.byteorder               sys.maxint
    sys.__displayhook__(        sys.call_tracing(           sys.maxsize
    sys.__doc__                 sys.callstats(              sys.maxunicode
    sys.__excepthook__(         sys.copyright               sys.meta_path
    sys.__format__(             sys.displayhook(            sys.modules
    sys.__getattribute__(       sys.dont_write_bytecode     sys.path
    sys.__hash__(               sys.exc_clear(              sys.path_hooks
    sys.__init__(               sys.exc_info(               sys.path_importer_cache
    sys.__name__                sys.exc_type                sys.platform
    sys.__new__(                sys.excepthook(             sys.prefix
    sys.__package__             sys.exec_prefix             sys.ps1
    sys.__reduce__(             sys.executable              sys.ps2
    sys.__reduce_ex__(          sys.exit(                   sys.py3kwarning
    sys.__repr__(               sys.exitfunc(               sys.pydebug
    sys.__setattr__(            sys.flags                   sys.setcheckinterval(
    sys.__sizeof__(             sys.float_info              sys.setdlopenflags(
    sys.__stderr__              sys.float_repr_style        sys.setprofile(
    sys.__stdin__               sys.getcheckinterval(       sys.setrecursionlimit(
    sys.__stdout__              sys.getdefaultencoding(     sys.settrace(
    sys.__str__(                sys.getdlopenflags(         sys.stderr
    sys.__subclasshook__(       sys.getfilesystemencoding(  sys.stdin
    sys._clear_type_cache(      sys.getprofile(             sys.stdout
    sys._current_frames(        sys.getrecursionlimit(      sys.subversion
    sys._getframe(              sys.getrefcount(            sys.version
    sys._mercurial              sys.getsizeof(              sys.version_info
    sys.api_version             sys.gettrace(               sys.warnoptions


  • 相关阅读:
    luogu P2685 [USACO07OPEN]抓牛Catch That Cow
    codevs 2021 中庸之道
    1018. 锤子剪刀布 (20)
    1017. A除以B (20)
    1016. 部分A+B (15)
    1013. 数素数 (20)
    1011. A+B和C (15)
    《C语言程序设计(第四版)》阅读心得(三)
    《C语言程序设计(第四版)》阅读心得(二)
    1008. 数组元素循环右移问题 (20)
  • 原文地址:https://www.cnblogs.com/reblue520/p/6239782.html
Copyright © 2011-2022 走看看