mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-27 15:43:58 +00:00
[python/zh-cn] Empty tuple is also False (#4297)
This commit is contained in:
parent
fd3b5cf629
commit
93af05dc04
@ -129,12 +129,13 @@ None # => None
|
|||||||
"etc" is None # => False
|
"etc" is None # => False
|
||||||
None is None # => True
|
None is None # => True
|
||||||
|
|
||||||
# None,0,空字符串,空列表,空字典都算是False
|
# None,0,空字符串,空列表,空字典,空元组都算是False
|
||||||
# 所有其他值都是True
|
# 所有其他值都是True
|
||||||
bool(0) # => False
|
bool(0) # => False
|
||||||
bool("") # => False
|
bool("") # => False
|
||||||
bool([]) # => False
|
bool([]) # => False
|
||||||
bool({}) # => False
|
bool({}) # => False
|
||||||
|
bool(()) # => False
|
||||||
|
|
||||||
|
|
||||||
####################################################
|
####################################################
|
||||||
|
Loading…
Reference in New Issue
Block a user