标签:startup back adl import exit exp span name odi
为了在 Terminal 中使用 Python 更加方便,在 home 目录下添加脚本 .pythonstartup,内容如下,
然后在 .bashrc 中添加 export PYTHONSTARTUP=~/.pythonstartup,
这样就能在 Terminal 中使用 Tab 实现 Python 的自动补全了。
#!/usr/bin/python # #----------------------------------------------------------------------------- # # Usage: # - rename this file to ".pythonstartup" # - put it under your home directory, e.g. "~" # - modify .bashrc, add following line, # export PYTHONSTARTUP=~/.pythonstartup # #----------------------------------------------------------------------------- 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
完。
标签:startup back adl import exit exp span name odi
原文地址:http://www.cnblogs.com/gaowengang/p/7965508.html