zoukankan      html  css  js  c++  java
  • Python中的Tab补全功能添加

    用 Python shell 没有 Tab 补全还是挺痛苦的,下面就记录一下如何补全:

    1. 先准备一个 tab.py 的脚本。

     >>> tap.py

     1 #!/usr/bin/python
     2 # python tab file
     3   
     4 import sys
     5 import readline
     6 import rlcompleter
     7 import atexit
     8 import os
     9 # tab completion
    10 readline.parse_and_bind('tab: complete')
    11 # history file
    12 histfile = os.path.join(os.environ['HOME'], '.pythonhistory')
    13 try:
    14     readline.read_history_file(histfile)
    15 except IOError:
    16     pass
    17 atexit.register(readline.write_history_file, histfile)
    18   
    19 del os, histfile, readline, rlcompleter

    2. 查看Python默认的模块存放地址

    1 Python 3.6.3 (v3.6.3:2c5fef8, Oct 3 2017, 18:22:56) [MSG v.1900 64 bit (AMD64)] on win32 
    2 Type "help", "copyright", "credits" or "license" for more information.  
    3 >>> import string   
    4 >>> string .__file__  
    5 'C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\string.py'

    3. 拷贝该脚本到默认模块存放路径

     >>> 'C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\'

    4. 现在可以用了.hhhhhhhhhhh

        

     

       

  • 相关阅读:
    matlab cell
    matlab linux 快捷键设置——有问题还是要解决
    latex 小结
    TOJ 1258 Very Simple Counting
    TOJ 2888 Pearls
    HDU 1248 寒冰王座
    TOJ 3486 Divisibility
    TOJ 3635 过山车
    TOJ 1840 Jack Straws
    HDU 4460 Friend Chains
  • 原文地址:https://www.cnblogs.com/orangeJJJ/p/9095419.html
Copyright © 2011-2022 走看看