python not 0 = "true, but not [15,12] or something else not false, but not [] or not {} is indeed true

s=(0,)
print(s)
print(type(s))
if s:
    print(s)
if not s:
    print("sakjfasfd")
print(not s)
print( not [55] )
sss="sdfasdf"
print(not sss)
sss2=""
print(not sss2)
isis=[]
print(not isis)
print(not {})
(0,)
<class 'tuple'>
(0,)
False
False
False
True
True
True

 

Guess you like

Origin www.cnblogs.com/DDBD/p/12242200.html