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