In Python, the else
statement takes no conditions:
if condition:
do_1()
else:
do_else()
In your case, since you want to evaluate another condition, after the if
, use an elif
:
if condition1:
do_1()
elif condition2:
do_2()
... # you can have as many elifs as you want
else:
do_else()
Note: Read the docs.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…