其他声明
if condition:
body
else:
body
只有在前面的条件语句全部计算为 False 时,else 语句才会执行它的主体。
if True:
print "It is true!"
else:
print "This won't get printed.."
# Output: It is true!
if False:
print "This won't get printed.."
else:
print "It is false!"
# Output: It is false!