对不起,这可能是一个可怕的问题.我JUST今天开始学习蟒蛇.我一直在阅读Python的Byte.现在我有一个涉及时间的Python项目.我在Python的Byte中找不到任何与时间有关的内容,所以我会问你:
如何在用户指定的时间内运行一个块然后中断?
例如(在一些伪代码中):
time = int(raw_input('Enter the amount of seconds you want to run this: '))
while there is still time left:
#run this block
Run Code Online (Sandbox Code Playgroud)
甚至更好:
import sys
time = sys.argv[1]
while there is still time left:
#run this block
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助.此外,非常感谢其他在线指南和教程.我真的很喜欢Python的Byte.但是,深入Python并不能引起我的注意.我想我应该把它搞砸了,并且更加努力地阅读那个.
python ×1