Commit 2ea55cd4 by BellCodeEditor

save project

parent 76a56210
Showing with 7 additions and 4 deletions
...@@ -6,13 +6,16 @@ f.write('李文:9本\n') ...@@ -6,13 +6,16 @@ f.write('李文:9本\n')
f.write('张伟:16本\n') f.write('张伟:16本\n')
f.write('何睿轩:15本\n') f.write('何睿轩:15本\n')
f.close() f.close()
# with open(r"C:\Users\61073\Desktop\text.txt","a",encoding="utf-8") as f: #
# f.write('何睿轩:15本\n') # f.write('何睿轩:15本\n')
new_date="" new_date=""
with open(r"C:\Users\61073\Desktop\text.txt","r",encoding="utf-8") as f: with open(r"C:\Users\61073\Desktop\text.txt","r",encoding="utf-8") as f:
a=f.read() a=f.read()
print(a) # print(a)
for date in a: for date in a:
if "小兰:12本"in date: if "小兰:12本"in date:
date=date.replace("小兰:12本","小兰:120本") date=date.replace("小兰:12本","小兰:120本")
new_date+=date new_date+=date
\ No newline at end of file
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