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

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