usleep in Python

后端 未结 8 954
执笔经年
执笔经年 2020-12-09 02:58

I was searching for a usleep() function in Python 2.7.

Does anybody know if it does exist, maybe with another function name?

8条回答
  •  旧巷少年郎
    2020-12-09 03:19

    how about this:

    import time
    def usleep(delay):
       mdelay = delay /1000
       now = time.time()
       while now + mdelay > time.time():
          pass
    

提交回复
热议问题