Is there anyway to terminate a python program only when the user shutsdown the system? I want to include the condition in the while loop so that it keeps on looping till the system shutsdown. Also is there a way to start the program automatically on booting the system?
This works for me:
while True :
pass # do something
This loop will be terminated when the system shuts down.
将你的 python 应用程序转换为 linux 服务比只使用 white true 好得多
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.