标签:
if语句之后的冒号
以四个空格的缩进来表示隶属关系, Python中不能随意缩进
if <条件1>:
statement
elif <条件2>:
statement
elif <条件3>:
statement
else:
statement
i = 1 if i > 0: print ‘positive i‘ i = i + 1 elif i == 0: print ‘i is 0‘ i = i * 10 else: print ‘negative i‘ i = i - 1 print ‘new i:‘,i
标签:
原文地址:http://www.cnblogs.com/saryli/p/5018252.html