dir:可以用来查看模块中的所有特性(函数,类,变量等)

>>> import copy
>>> dir(copy)
['Error', 'PyStringMap', '_EmptyClass', '__all__', '__builtins__', '__cached__',
 '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '_c
opy_dispatch', '_copy_immutable', '_copy_with_constructor', '_copy_with_copy_met
hod', '_deepcopy_atomic', '_deepcopy_dict', '_deepcopy_dispatch', '_deepcopy_lis
t', '_deepcopy_method', '_deepcopy_tuple', '_keep_alive', '_reconstruct', 'built
ins', 'copy', 'deepcopy', 'dispatch_table', 'error', 'name', 't', 'weakref']
>>> [x for x in dir(copy) if not x.startswith('_')]
['Error', 'PyStringMap', 'builtins', 'copy', 'deepcopy', 'dispatch_table', 'erro
r', 'name', 't', 'weakref']
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2021-04-29
  • 2021-04-20
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-01
  • 2021-12-21
  • 2021-08-08
  • 2021-07-30
相关资源
相似解决方案