小白教程
所有教程
关于
Search
172.71.254.147
172.71.254.147
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Python func bool”的源代码
本页内容
上一节:
Python_func_str
下一节:
Python3_func_exec
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:bool()}}[[Category:python3 built in functions|25]] = Python bool() 函数 = [[python built in functions|Python 内置函数]] == 描述 == '''bool()''' 函数用于将给定参数转换为布尔类型,如果没有参数,返回 False。 bool 是 int 的子类。 === 语法 === 以下是 bool() 方法的语法: <sample title="" desc="" lang="python" hererun="1"> class bool([x]) </sample> === 参数 === * x -- 要进行转换的参数。 === 返回值 === 返回 True 或 False。 以下展示了使用 bool 函数的实例: <sample title="" desc="" lang="python" hererun="1"> >>>bool() False >>> bool(0) False >>> bool(1) True >>> bool(2) True >>> issubclass(bool, int) # bool 是 int 子类 True </sample> [[python built in functions|Python 内置函数]]
返回至“
Python func bool
”。
上一节:
Python_func_str
下一节:
Python3_func_exec