with open("./作业.txt", "w", encoding="utf-8") as w: w.write("晓出净慈寺送林子方\n毕竟西湖六月中\n风光不与四时同\n接天莲叶无穷碧\n映日荷花别样红") with open("./作业.txt", "r", encoding="utf-8") as r: con = r.readlines() del con[1] with open("./作业.txt", "w", encoding="utf-8") as w: w.write("".join(con)) with open("./作业.txt", "r", encoding="utf-8") as r: cont = r.read() print(cont)
标签:练习题,utf,encoding,Python,作业,----,txt,open,con From: https://www.cnblogs.com/cenb/p/17046528.html