Commit 6c33ea15 by BellCodeEditor

save project

parent 0a2603f8
Showing with 18 additions and 2 deletions
...@@ -15,11 +15,27 @@ with open(r"C:\Users\Administrator\Desktop\test.txt","a",encoding="utf-8") as fi ...@@ -15,11 +15,27 @@ with open(r"C:\Users\Administrator\Desktop\test.txt","a",encoding="utf-8") as fi
file.write("小三:12本\n") file.write("小三:12本\n")
naw_data=""
with open(r"C:\Users\Administrator\Desktop\test.txt","r",encoding="utf-8") as file1: with open(r"C:\Users\Administrator\Desktop\test.txt","r",encoding="utf-8") as file1:
for data in file1: for data in file1:
if"小三:12本"in data: if"小三:12本"in data:
print("数据在文件中") data=data.replace("小三:12本","小三:16530本")
naw_data +=data
with open(r"C:\Users\Administrator\Desktop\test.txt","w",encoding="utf-8") as file1:
file1.write(naw_data)
......
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