python 中time.sleep沒有作用


很簡單的一個程序:

# -*- coding: utf-8 -*-

import MySQLdb,os,json,time
#from wsgiref.simple_server import make_server
from cgi import parse_qs, escape
import sys

def checkCompany(keyword = None):
    row = None

    if row is None:
        for i in range(10):
            print(i, flush=True)
    else :
        return True
    time.sleep(10)
    return 'end'


if __name__ == '__main__':
    return_body = checkCompany()

    if return_body is None:
        return json.dumps([{'data':123}])
    else: 
        return return_body

但是根本就沒有起作用time.sleep

The actual suspension time may be less than that requested because any caught signal will terminate the sleep() following execution of that signal’s catching routine.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM