目录函数:探索SIC MOSFET管及其专用驱动电源的特性
9.6 dir函数您可以使用内置的dir函数来列出模块定义的标识符。这些标识符包括函数、类和变量。当您为dir()提供一个模块名时,它返回该模块定义的名称列表。如果不提供参数,则返回当前模块中定义的名称列表。
示例:
1 $ python
2 >>> import sys # 获取此处的属性列表(此处是sys模块)
3 >>> dir(sys)
4 ['__displayhook__', '__doc__', '__excepthook__', '__name__',
5 '__package__', '__s 6 tderr__', '__stdin__', '__stdout__', '_clear_type_cache',
7 '_compact_freelists',
8 '_current_frames',
9 '_getframe',
10 'api_version', 'argv', 'builtin_module_names', 'byteorder', 'call_tracing', 'callstats', 'copyright', 'displayhook' , 'dllhandle' 12 , 'dont_write_bytecode', 'exc_info', 'excepthook', 'exec_prefix', 'executable',
13 'exit', 'flags', 'float_info', 'getcheckinterval',
14 'getdefaultencoding', 'getfil esystemencoding', 'getprofile', 'getrecursionlimit', 'getrefcount', 'getsizeof', 'gettrace', 'getwindowsversion', 'hexversion', 'intern', 'maxsize',
19 'maxunicode 20 ', 'meta_path', 'modules', 'path_hooks', ' path_importer_cache',
21 'platfor m22 ]
示例:
1 $ python
2 >>> import sys # 获取此处的属性列表(此处是sys模块)
3 >>> dir(sys)
4 ['__displayhook__', '__doc__', '__excepthook__', '__name__',
5 '__package__', '__s 6 tderr__', '__stdin__', '__stdout__', '_clear_type_cache',
7 '_compact_freelists',
8 '_current_frames',
9 '_getframe',
10 'api_version', 'argv', 'builtin_module_names', 'byteorder', 'call_tracing', 'callstats', 'copyright', 'displayhook' , 'dllhandle' 12 , 'dont_write_bytecode', 'exc_info', 'excepthook', 'exec_prefix', 'executable',
13 'exit', 'flags', 'float_info', 'getcheckinterval',
14 'getdefaultencoding', 'getfil esystemencoding', 'getprofile', 'getrecursionlimit', 'getrefcount', 'getsizeof', 'gettrace', 'getwindowsversion', 'hexversion', 'intern', 'maxsize',
19 'maxunicode 20 ', 'meta_path', 'modules', 'path_hooks', ' path_importer_cache',
21 'platfor m22 ]
664.92KB
文件大小:
评论区