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

删除txt文件内容

时间:2017-08-19 11:11:10      阅读:213      评论:0      收藏:0      [点我收藏+]

标签:bsp   lines   聊天记录   英雄   记录   not   adc   文件   write   

删除txt文件里的 聊天记录的时间那一行

f = open("d:\\面试.txt", "r")
g = open("d:\\英雄联盟ADC技巧.txt", "w")
for line in f.readlines():
    if "21:" not in line:
        g.write(line)
f.close()
g.close()

 

删除txt文件内容

标签:bsp   lines   聊天记录   英雄   记录   not   adc   文件   write   

原文地址:http://www.cnblogs.com/bingxing/p/7392996.html

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