1. 程式人生 > >while 每秒執行一次

while 每秒執行一次

1. 每秒執行一次命令

import time

while True:
    message_log.click()
    time.sleep(2)

2. while迴圈用法

#coding:utf-8
#coding:cp936
from time import sleep
count = 0
while (count < 10):

    print "test",count
    count = count + 1
    sleep(3)
print "end"
while 條件:
    commands