码迷,mamicode.com
首页 > 其他好文 > 详细

file_object

时间:2019-01-03 21:38:05      阅读:150      评论:0      收藏:0      [点我收藏+]

标签:npm   object   str   log   with open   nes   pytho   readline   print   

#!/use/bin/python
#encoding=utf-8

filename="WinPMT.log"
filename_1="WinPMT_stress.txt"

with open(filename_1,"w") as file_object_1:
    file_object_1.write("")
with open(filename) as file_object:
    lines=file_object.readlines()

for line in lines:
    if "error"in line or "Cycle:" in line:
        print(line)
        with open(filename_1,‘a‘) as file_object_1:
            file_object_1.write(line)

file_object

标签:npm   object   str   log   with open   nes   pytho   readline   print   

原文地址:https://www.cnblogs.com/zzl112893/p/10168965.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!