Commit 29582822 by BellCodeEditor

auto save

parent 348cafda
Showing with 34 additions and 0 deletions
with open(r"C:\Users\windoins\Desktop\123.txt","w",encoding="utf-8")as file:
file.write("锦瑟\n")
file.write("[唐] 李商隐\n")
file.write("锦瑟无端五十弦,\n")
file.write("一弦一柱思华年。\n")
file.write("庄生晓梦迷蝴蝶,\n")
file.write("望帝春心托杜鹃。\n")
file.write("沧海月明珠有泪,\n")
file.write("蓝田日暖玉生烟。\n")
file.write("此情可待成追忆,\n")
file.write("只是当时已惘然。\n")
with open(r"C:\Users\windoins\Desktop\123.txt","r",encoding="utf-8")as file:
a=file.readlines()
new_file=""
for file in a:
if "蓝田日暖玉生烟。" in file:
file=file.replace("蓝田日暖玉生烟。","——————————")
if "此情可待成追忆," in file:
file=file.replace("此情可待成追忆,","——————————")
new_file=new_file+file
print(new_file)
with open(r"C:\Users\windoins\Desktop\123.txt","w",encoding="utf-8")as file:
file.write(new_file)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment