摘要: int类型转换为bool类型时,0为False,非0为True str类型转换为bool类型时,空字符串和None为False,不空为True 以下为代码示例: 1 # int转换为bool 2 # 0是False 3 print(bool(0)) 4 # 非0是True 5 print(bool( 阅读全文
posted @ 2020-06-10 11:36 奔奔-武 阅读(13338) 评论(0) 推荐(0) 编辑