dsfsfs 发表于 2018-8-9 08:57:56

Python tab 补全

  1. 先准备一个tab.py的脚本
  shell> cat tab.py
12345678910111213141516171819#!/usr/bin/python# python tab fileimport sysimport readlineimport rlcompleterimport atexitimport os# tab completionreadline.parse_and_bind('tab: complete')# history filehistfile = os.path.join(os.environ['HOME'], '.pythonhistory')try:    readline.read_history_file(histfile)except IOError:    passatexit.register(readline.write_history_file, histfile)del os, histfile, readline, rlcompleter  2. 查看Python默认的模块存放地址
1234567# pythonPython 2.6.6 (r266:84292, Nov 22 2013, 12:16:22) on linux2Type "help", "copyright", "credits" or "license" for more information.>>> import sys>>> sys.path['', '/usr/lib64/python26.zip', '/usr/lib64/python2.6', '/usr/lib64/python2.6/plat-linux2',   3. 拷贝该脚本到默认模块存放路径
1cp tab.py/usr/lib64/python2.6/  4. 现在可以用了
页: [1]
查看完整版本: Python tab 补全