我有一个python脚本,没有在循环中嵌入语句而没有sleep(update_time)
它可以正常工作:
import oauth, tweepy, os
from time import sleep
message = "hello"
update_time = 24 * 60 * 60 # 24 hours
def init():
global api
#confident information
consumer_key = "***"
consumer_secret = "***"
callback_url = "https://twitter.com/Problem196"
access_key="***"
access_secret="***"
auth = tweepy.OAuthHandler(consumer_key, consumer_secret, callback_url)
auth.set_access_token(access_key, access_secret)
api=tweepy.API(auth)
init()
while True:
os.environ['http_proxy'] = ''
api.update_status(message)
sleep(update_time)
问题是如何在不等待Linux终端的情况下使其无限自主地工作(我通过命令python py/twi.py
启动了脚本)?