有没有办法让代码行继续在不同的代码行上?例如:
a = raw_input("1 or 2")
if a == "1" :
a = raw_input("3 or 4")
if a == "3" :
*line of code that makes the script progress at line #14*
if a == "4" :
*line of code that makes the script progress at line #14*
if a = "2" :
a = raw_input("5 or 6")
if a == "5" :
*line of code that makes the script progress at line #14*
if a == "6" :
*line of code that makes the script progress at line #14*
print ("chocolate")
(^line #14^)
答案 0 :(得分:-1)
您正在寻找的构造是一个'goto'语句,并且没有python不支持goto语句。看到这个问题:Is there a label/goto in Python?可以用来在python中实现你想要的延续类型。