from goto import goto, label
label .getinput
i = raw_input("Enter either 'a', 'b' or 'c', or any other letter to quit: ")
if i in ('a', 'b', 'c'):
goto *i
else:
goto .quit
label .a
print "You typed 'a'"
label .b
print "You typed 'b'"
label .c
print "You typed 'c'"
label .quit
print "Finished\n"
然后运行它:
$ python gt.py
Enter either 'a', 'b' or 'c', or any other letter to quit: b
You typed 'b'
You typed 'c'
Finished
你可以用
例如
输出:
你可以这样做
或者有一个函数列表:
今天我可以给你一些建议:
使用转到
http://entrian.com/goto/
安装软件包:
编写一些代码:
然后运行它:
警告:在练习之前,请先查看日历。顺便说一句,代码真的很管用。你知道吗
相关问题 更多 >
编程相关推荐