adapted from http://huangjiahua.livejournal.com/135904.html
import readline, rlcompleter; readline.parse_and_bind("tab: complete")
如果您嫌每次都要键入这东西麻烦的话,可以把上边这行写到 ~/.pythonstartup.py ,
Then, add this to your ~/.bashrc:
export PYTHONSTARTUP=~/.pythonstartup.py