1、dir:查看模板中的方法
import itertools print(dir(itertools))
结果
[’_doc_’, ‘_loader_’, ‘_name_’, ‘_package_’, ‘_spec_’, ‘_grouper’, ‘_tee’, ‘_tee_dataobject’, ‘accumulate’, ‘chain’, ‘combinations’, ‘combinations_with_replacement’, ‘compress’, ‘count’, ‘cycle’, ‘dropwhile’, ‘filterfalse’, ‘groupby’, ‘islice’, ‘permutations’, ‘product’, ‘repeat’, ‘starmap’, ‘takewhile’, ‘tee’, ‘zip_longest’]
2、help:查看模块或方法的内容
import itertools print(help(itertools.product())) -这里方法名称是区分大小写的 结果
-这里的方法名称是区分大小写的,比如:
另外一种方法: cmd进入到python后,输入help()进入交互式,然后直接输入模块或是方法 3、sys.builtin_module_names查看内置模块
import sys print(sys.builtin_module_names)
结果:
(’_ast’, ‘_bisect’, ‘_blake2’, ‘_codecs’, ‘_codecs_cn’, ‘_codecs_hk’, ‘_codecs_iso2022’, ‘_codecs_jp’, ‘_codecs_kr’, ‘_codecs_tw’, ‘_collections’, ‘_csv’, ‘_datetime’, ‘_functools’, ‘_heapq’, ‘_imp’, ‘_io’, ‘_json’, ‘_locale’, ‘_lsprof’, ‘_md5’, ‘_multibytecodec’, ‘_opcode’, ‘_operator’, ‘_pickle’, ‘_random’, ‘_sha1’, ‘_sha256’, ‘_sha3’, ‘_sha512’, ‘_signal’, ‘_sre’, ‘_stat’, ‘_string’, ‘_struct’, ‘_symtable’, ‘_thread’, ‘_tracemalloc’, ‘_warnings’, ‘_weakref’, ‘_winapi’, ‘array’, ‘atexit’, ‘audioop’, ‘binascii’, ‘builtins’, ‘cmath’, ‘errno’, ‘faulthandler’, ‘gc’, ‘itertools’, ‘marshal’, ‘math’, ‘mmap’, ‘msvcrt’, ‘nt’, ‘parser’, ‘sys’, ‘time’, ‘winreg’, ‘xxsubtype’, ‘zipimport’, ‘zlib’)
4、模块是内置还是外置