import os import re def getVersion(binDir,tmpf): with open(tmpf,"wb") as objf: for lists in os.listdir(binDir): path = os.path.join(binDir,lists) dirc,fileNm = os.path.split(path) f = open(path,"rb") strb = f.read() info = re.findall(rb'$Version:[0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}',strb) objf.write(bytes(fileNm,encoding="ascii")+info[0]+b" ")
匹配结果 :$Version:0000/00/00 00:00:00