【发布时间】:2015-03-02 10:03:58
【问题描述】:
我有以下for loop:
for user_id in new_followers:
try:
t.direct_messages.new(user_id=user_id, text="Thanks for following. Etc etc etc")
print("Sent DM to %d" % (user_id))
followers_old.add(user_id)
为避免 API 限制,我想在每次发送 100 条直接消息时暂停循环 600 秒。
最好的方法是什么?
【问题讨论】:
-
@vaultah 不是真的。我知道如何让 python 程序休眠,但我的问题是在 X 循环完成后让它休眠。
-
你可以使用time.sleep(x),这里x的单位是mili sec
标签: python