Created
March 28, 2012 09:03
-
-
Save bluven/2224927 to your computer and use it in GitHub Desktop.
在给定的时间里计数
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# coding:utf-8 | |
from time import time | |
def loop_in_sec(duration = 1): | |
start = time() | |
count = 1 | |
while (time() - start) < duration: | |
yield count | |
count += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment