我想在文本文件中删除python的所有单引号。 我做了这段代码:
for line in open('check.txt',"r"):
line=line.replace("'","")
f.close()
但它对我不起作用。 请建议我一个正确的方法。
答案 0 :(得分:0)
with open('C://file.txt') as filein, open('C://fout.txt','w') as fileout:
for line in filein:
line=line.replace("'","")
fileout.write(line)