Created
May 22, 2014 07:18
-
-
Save luistung/ebcf5e69ba0897f1c8f4 to your computer and use it in GitHub Desktop.
python全局计数器
This file contains hidden or 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
def counter(interval): | |
if not hasattr(counter,'count'): | |
counter.count = 0 | |
counter.count += 1 | |
import sys | |
if counter.count % interval == 0: print >>sys.stderr, counter.count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
用于记录文件已处理行数,每隔interval输出一次