1. 程式人生 > >刪除txt文件內容

刪除txt文件內容

面試 txt readlines span 英雄聯盟 clas 文件內容 log 聊天

刪除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文件內容