1
2
3
4
5
6
|
xpleaf@py:~/seminar6/day1$ python
Python
2.7
.
3
(
default
, Aug
1
2012
,
05
:
14
:
39
)
[GCC
4.6
.
3
] on linux2
Type
"help"
,
"copyright"
,
"credits"
or
"license"
for
more information.
>>>
import
sys
>>> sys. =====>按tab键,想看看sys的子模块,结果就是按出了一大堆空格键
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#!/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
|
1
2
3
|
>>>
import
sys
>>> sys.path
[
''
,
'/usr/lib/python2.7'
,
'/usr/lib/python2.7/plat-linux2'
,
'/usr/lib/python2.7/lib-tk'
,
'/usr/lib/python2.7/lib-old'
,
'/usr/lib/python2.7/lib-dynload'
,
'/usr/lib/python2.7/dist-packages'
,
'/usr/lib/python2.7/dist-packages/PIL'
,
'/usr/lib/python2.7/dist-packages/gst-0.10'
,
'/usr/lib/python2.7/dist-packages/gtk-2.0'
,
'/usr/lib/python2.7/dist-packages/ubuntu-sso-client'
,
'/usr/lib/python2.7/dist-packages/ubuntuone-client'
,
'/usr/lib/python2.7/dist-packages/ubuntuone-control-panel'
,
'/usr/lib/python2.7/dist-packages/ubuntuone-couch'
,
'/usr/lib/python2.7/dist-packages/ubuntuone-installer'
,
'/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol'
]
|
1
2
3
|
xpleaf@py:~/seminar6/day1$ sudo mv tab.py /usr/lib/python2.
7
/
xpleaf@py:~/seminar6/day1$ ll /usr/lib/python2.
7
/tab.py
-rw-rw-r--
1
xpleaf xpleaf
419
8
月
6
23
:
53
/usr/lib/python2.
7
/tab.py
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
xpleaf@py:~/seminar6/day1$ python
Python
2.7
.
3
(
default
, Aug
1
2012
,
05
:
14
:
39
)
[GCC
4.6
.
3
] on linux2
Type
"help"
,
"copyright"
,
"credits"
or
"license"
for
more information.
>>>
import
sys ===>导入sys模块只是为了下面对tab键补全做测试
>>>
import
tab ===>这才是重点
>>> sys. ===>输入sys.后按两次tab键
sys.__class__( sys.exit(
sys.__delattr__( sys.exitfunc(
sys.__dict__ sys.flags
sys.__displayhook__( sys.float_info
sys.__doc__ sys.float_repr_style
sys.__excepthook__( sys.getcheckinterval(
sys.__format__( sys.getdefaultencoding(
sys.__getattribute__( sys.getdlopenflags(
sys.__hash__( sys.getfilesystemencoding(
sys.__init__( sys.getprofile(
sys.__name__ sys.getrecursionlimit(
sys.__new__( sys.getrefcount(
sys.__package__ sys.getsizeof(
sys.__reduce__( sys.get
trace
(
sys.__reduce_ex__( sys.hexversion
sys.__repr__( sys.long_info
sys.__setattr__( sys.maxint
sys.__sizeof__( sys.maxsize
sys.__stderr__ sys.maxunicode
sys.__stdin__ sys.meta_path
sys.__stdout__ sys.modules
sys.__str__( sys.path
sys.__subclasshook__( sys.path_hooks
sys._clear_type_cache( sys.path_importer_cache
sys._current_frames( sys.platform
sys._getframe( sys.prefix
sys._mercurial sys.ps1
sys.api_version sys.ps2
sys.argv sys.py3kwarning
sys.builtin_module_names sys.pydebug
sys.byteorder sys.setcheckinterval(
sys.call_tracing( sys.setdlopenflags(
sys.callstats( sys.setprofile(
sys.copyright sys.setrecursionlimit(
sys.displayhook( sys.set
trace
(
sys.dont_write_bytecode sys.stderr
sys.exc_clear( sys.stdin
sys.exc_info( sys.stdout
sys.exc_type sys.subversion
sys.excepthook( sys.version
sys.exec_prefix sys.version_info
sys.executable sys.warnoptions
>>> sys.
|