if 语句包含零个或多个elif子句及可选的else子句。关键字'elif'是'else if'的缩写,适用于避免过多的缩进。if...elif...elif...序列可以当作其他语言中switch或case语句的替代品,实例如下:
>>> x = int(input("Please enter an integer: "))
>>> if x < 0:
... print('Negative changed to zero')
... elif x == 0:
... print('Zero')
... else:
... print('More')