python tab键补齐
短信预约 -IT技能 免费直播动态提醒
在mac上测试
ipython
In [4]: import sys
In [5]: sys.path
Out[5]:
['',
'/usr/local/bin',
'/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg',
'/Library/Python/2.7/site-packages/mysql-0.0.1-py2.7.egg',
'/Library/Python/2.7/site-packages/ipython-3.2.1-py2.7.egg',
'/Library/Python/2.7/site-packages/gnureadline-6.3.3-py2.7-macosx-10.8-intel.egg',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
'/Library/Python/2.7/site-packages',
'/Library/Python/2.7/site-packages/ipython-3.2.1-py2.7.egg/IPython/extensions',
'/private/var/root/.ipython']
代码有了,我们还需要将脚本放到python指定的目录下,可以使用sys.path来查看一下
(linux服务器):一般我们会将这一类代码放在/usr/local/lib/python2.7/dist-packages目录下
(MAC存放在这个目录下)/Library/Python/2.7/site-packages
admindeMacBook-Air-62:site-packages admin$ vim 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
代码中就可以import tab了
In [11]: import tab
In [12]: sys.
sys.__class__( sys.__setattr__( sys.displayhook( sys.getrecursionlimit( sys.prefix
sys.__delattr__( sys.__sizeof__( sys.dont_write_bytecode sys.getrefcount( sys.ps1
sys.__dict__ sys.__stderr__ sys.exc_clear( sys.getsizeof( sys.ps2
sys.__displayhook__( sys.__stdin__ sys.exc_info( sys.gettrace( sys.ps3
sys.__doc__ sys.__stdout__ sys.exc_type sys.hexversion sys.py3kwarning
sys.__egginsert sys.__str__( sys.excepthook( sys.last_traceback sys.setcheckinterval(
sys.__excepthook__( sys.__subclasshook__( sys.exec_prefix sys.last_type( sys.setdlopenflags(
sys.__format__( sys._clear_type_cache( sys.executable sys.last_value sys.setprofile(
sys.__getattribute__( sys._current_frames( sys.exit( sys.long_info sys.setrecursionlimit(
sys.__hash__( sys._getframe( sys.exitfunc( sys.maxint sys.settrace(
sys.__init__( sys._mercurial sys.flags sys.maxsize sys.stderr
sys.__name__ sys.api_version sys.float_info sys.maxunicode sys.stdin
sys.__new__( sys.argv sys.float_repr_style sys.meta_path sys.stdout
sys.__package__ sys.builtin_module_names sys.getcheckinterval( sys.modules sys.subversion
sys.__plen sys.byteorder sys.getdefaultencoding( sys.path sys.version
sys.__reduce__( sys.call_tracing( sys.getdlopenflags( sys.path_hooks sys.version_info
sys.__reduce_ex__( sys.callstats( sys.getfilesystemencoding( sys.path_importer_cache sys.warnoptions
sys.__repr__( sys.copyright sys.getprofile( sys.platform
In [12]: sys.
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341