snail1988
2014-11-09 11:57:43 +08:00
OSX 10.10/10.9.5 / Ubuntn 14.04 LTS
Python 3.4.2/3.4 2.7.6/2.7.8
代码片段
def searchCrash(file):
try:
with open(file, 'r') as f:
global count
for line in f:
if 'StackTrace' in line:
count = count + 1
except Exception as e:
# raise e
pass
finally:
pass
def traverseFile(rootDir):
for lists in os.listdir(rootDir):
path = os.path.join(rootDir, lists)
if os.path.isfile(path):
searchCrash(path)
我在一个2000个文件 总计4GB的目录上调用 traverseFile方法