使用方法很简单,举os类型为例,在Python命令窗口输入 dir(‘os’) 即可查看os模块的属性

打开cmd命令窗口

输入python(注意:计算机需要有Python环境,配置好Python环境变量)

输入dir('os')命令

如何查看对象某个属性的帮助文档 ?

如要查看’os’的split属性,可以用__doc__, 使用方法为print(’os’.split.__doc__)

print(’os’.split.__doc__)

查看对象的某个属性还可以用help函数,使用方法为help(‘os’.split)

help(‘os’.split)

help('os'.strip)

查看某个对象的详细文档用help

如查看str类型的详细文档可以用help(‘os’)。如果文档的内容很多,help会列出全部文档的一部分,并在左下角提示“-- More --”,按Enter键盘会显示更多的信息,要回到命令行交互模式可按Ctrl + C。

help(‘os’)

相关文章:

  • 2021-11-23
  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
  • 2021-05-21
  • 2021-07-16
  • 2022-12-23
猜你喜欢
  • 2021-09-23
  • 2022-01-08
  • 2021-11-23
  • 2021-04-27
  • 2022-12-23
  • 2022-01-08
相关资源
相似解决方案