Commit 60b56b21 by BellCodeEditor

save project

parent 48dc3be0
Showing with 9 additions and 2 deletions
...@@ -8,4 +8,11 @@ with open(r"C:\Users\admin\Desktop\test.txt","a",encoding="utf-8")as file: ...@@ -8,4 +8,11 @@ with open(r"C:\Users\admin\Desktop\test.txt","a",encoding="utf-8")as file:
file.write("李宁:12本\n") file.write("李宁:12本\n")
with open(r"C:\Users\admin\Desktop\test.txt","r",encoding="utf-8")as file: with open(r"C:\Users\admin\Desktop\test.txt","r",encoding="utf-8")as file:
a=file.read() a=file.read()
print(a) print(a)
\ No newline at end of file with open(r"C:\Users\admin\Desktop\test.txt","r",encoding="utf-8")as file:
new_date=""
for date in file:
if "小丽:11本" in date:
date=date.replace("小丽:11本","小丽:12本")
new_date+=date
print(new_date)
\ No newline at end of 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