[root@meng python]# cat tab.py

#!/usr/bin/python   

  

 

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 

[root@meng python]# pwd

/python

[root@meng python]# ll

总用量 4

-rw-r--r--. 1 root root 466 7月  31 13:41 tab.py


[root@meng python]# chmod +x tab.py 

[root@meng python]# python

Python 2.6.6 (r266:84292, Nov 22 2013, 12:16:22) 

[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import tab

>>> import os

>>> os.

Display all 244 possibilities? (y or n)

os.EX_CANTCREAT             os.WIFEXITED(               os.execle(                  os.popen(

os.EX_CONFIG                os.WIFSIGNALED(             os.execlp(                  os.popen2(

os.EX_DATAERR               os.WIFSTOPPED(              os.execlpe(                 os.popen3(