相关疑难解决方法(0)

如何永远运行Python程序?

我需要在无限循环中永远运行我的Python程序.

目前我正在运行它 -

#!/usr/bin/python

import time

# some python code that I want 
# to keep on running


# Is this the right way to run the python program forever?
# And do I even need this time.sleep call?
while True:
    time.sleep(5)
Run Code Online (Sandbox Code Playgroud)

有没有更好的方法呢?或者我甚至需要time.sleep打电话?有什么想法吗?

python infinite-loop

67
推荐指数
6
解决办法
21万
查看次数

标签 统计

infinite-loop ×1

python ×1