Python · 类

布尔

Returns True when the argument is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.

调用签名(object=False, /)
ZHONGWEN
PYTHON
Chinese example

中文代码示例

# 案例:布尔
打印(布尔(1))
可直接放进 .cs / .中py 文件运行。转换器会把中文代码交给真实 Python 解释器。
Parameters

参数说明

1 个参数
参数类型 / 传入方式说明
object可选 · 默认 False
未声明位置参数,按顺序直接传值

按函数业务含义传入 object;首次使用建议先 打印(结果) 确认其作用。

常见错误:类型不匹配会报 TypeError;按字段类型列传值,首次使用建议先 打印(结果) 确认结构
Playbook

基础用法 · 进阶组合 · 错误排查

# 案例:布尔
打印(布尔(1))