if 語句
if condition:
body
if 語句檢查條件。如果它計算為 True,它將執行 if 語句的主體。如果它評估為 False,它會跳過身體。
if True:
print "It is true!"
>> It is true!
if False:
print "This won't get printed.."
條件可以是任何有效的表示式:
if 2 + 2 == 4:
print "I know math!"
>> I know math!