• Game


    import os
    import sys
    #coding=utf-8
    
    def CountTime(filepath):
        try:
            fobj = open(filepath,'rb')
            total = 0
            times = 0
            line = fobj.readline()
            while line:
                line = line.strip('
    ')
                if(line.find('Load Time: ') != -1):
                    endpos = line.find(' ms')
                    total += int(line[11:endpos])
                    times += 1
                line = fobj.readline()
        except Exception as e2:
            print(e2)
            print("open error")
    
        fobj.close()
        print('%s	 avg time:	 %d'%(filepath.split('\')[-1], total/times))
    
    def ProcessGame(foldpath):
        for root,dir,filenames in os.walk(foldpath):
            for filename in filenames:
                CountTime(os.path.join(root,filename))
    
    
    
    
    if __name__ == "__main__":
        try:
            ProcessGame(sys.argv[1])
        except Exception as e1:
            print(e1)
            print("usage:1.py d:\test")
    

      

  • 相关阅读:
    盛最多水的容器
    字符串的排序
    整数拆分
    TCP和UDP编程
    旋转图像
    非递减数列
    不同路径2
    不同路径
    压缩拉伸图片
    Java对List分割及使用Spring多线程调用
  • 原文地址:https://www.cnblogs.com/xiaobaichuangtianxia/p/3951881.html
Copyright © 2020-2023  润新知