1.认识dir()
功能:查看指定模块的功能列表,以及任意指定对象的功能列表。
例如:
import re
dir(re)
['A', 'ASCII', 'DEBUG', 'DOTALL', 'I', 'IGNORECASE', 'L', 'LOCALE', 'M', 'MULTIL
INE', 'S', 'Scanner', 'T', 'TEMPLATE', 'U', 'UNICODE', 'VERBOSE', 'X', '_MAXCACH
E', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__'
, '__name__', '__package__', '__spec__', '__version__', '_alphanum_bytes', '_alp
hanum_str', '_cache', '_cache_repl', '_compile', '_compile_repl', '_expand', '_l
ocale', '_pattern_type', '_pickle', '_subx', 'compile', 'copyreg', 'error', 'esc
ape', 'findall', 'finditer', 'fullmatch', 'match', 'purge', 'search', 'split', '
sre_compile', 'sre_parse', 'sub', 'subn', 'sys', 'template']
例如:
d = []
dir(d)