python中的布尔值

取值只有True, False. bool值没有操作.

转换问题:
str => int int(str)
int => str str(int)
int => bool bool(int). 0是False 非0是True
bool=>int int(bool) True是1, False是0
str => bool bool(str) 空字符串串是False, 不空是True
bool => str str(bool) 把bool值转换成相应的”值”

猜你喜欢

转载自blog.csdn.net/liukai6/article/details/82430432