韋大仙--python對文件操作 2--寫入與修改

請大家看一段代碼: yesterday2是我之前上個帖子創建的文件,爲了方便大家看清我把本來的代碼複製到下面: coding=utf-8 f=open("yesterday2","r",encoding="utf-8") f_new=open("yesterday2.bak","w",encoding="utf-8") for line in f: if "昨日當我年少輕狂" in line: l
相關文章
相關標籤/搜索