python 学习笔记之 dir 、help函数
·
1、dir()函数
作用:返回对象的有效属性列表(如方法、变量等)。
dir([object])
2、help() 函数
作用:返回对象的详细帮助文档(docstring)。
help([object])
实例1:
# 查看列表的append方法文档
help(list.append)
# 输出:Help on method_descriptor: append(self, object, /) ...
# 查看math模块的帮助
import math
help(math)
# 输出:NAME math DESCRIPTION This module provides... FUNCTIONS ceil(x) ...
实例2:

更多推荐
所有评论(0)