Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
387 views
in Technique[技术] by (71.8m points)

usleep in Python

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Since usleep generally means you want to delay execution for x microseconds, you must divide the seconds value by 1000000.

import time
time.sleep(seconds/1000000.0)

time.sleep() takes seconds as a parameter.

http://docs.python.org/library/time.html#time.sleep


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...