if <boolean> : # do this布尔值必须为True或False。那么为什么if "poi": print "yes"输出:是我不明白为什么要打印,因为“ poi”是对还是错。
3 回答

慕姐4208626
TA贡献1852条经验 获得超7个赞
在python中,除空字符串外的任何字符串默认为 True
即
if "MyString":
# this will print foo
print("foo")
if "":
# this will NOT print foo
print("foo")
添加回答
举报
0/150
提交
取消