MaxWen

关注

python删除文件中某一行

MaxWen

关注

阅读 223

2022-05-18

将文本中的 tasting123删除 
with open("fileread.txt","r",encoding="utf-8") as f:
lines = f.readlines()
#print(lines)
with open("fileread.txt","w",encoding="utf-8") as f_w:
for line in lines:
if "tasting123" in line:
continue
f_w.write(line)

实际是文件内容重写




相关推荐

产品喵dandan米娜

python输出文件某一行

产品喵dandan米娜 25 0 0

新鲜小饼干

python 打开文件替换某一行

新鲜小饼干 30 0 0

脱下愤怒的小裤衩

C++ 读取 txt 文件件中某一行

脱下愤怒的小裤衩 205 0 0

吓死我了_1799

table中 点击某一行变色

吓死我了_1799 135 0 0

眸晓

python去除某一行的数据

眸晓 44 0 0

腊梅5朵

python删除第一行

腊梅5朵 82 0 0

_铁马冰河_

使用vue动态在列表中添加或者删除某一行

_铁马冰河_ 12 0 0

代码敲到深夜

python取矩阵的某一行_Pythonnumpy提取矩阵的某一行或某一列的实例

代码敲到深夜 248 0 0

Star英

python 写文件 一行

Star英 78 0 0

小铺有酒一两不够

Python numpy 提取矩阵的某一行或某一列

小铺有酒一两不够 118 0 0

精彩评论(0)

0 0 举报