Commit 485f7002 by BellCodeEditor

save project

parent 7db54b60
Showing with 7 additions and 0 deletions
......@@ -7,6 +7,7 @@ f.write('张伟:16本\n')
f.close()
with open(r"C:\Users\Administrator\Desktop\txet.txt","a",encoding="utf-8") as f:
f.write('俞彪:1本\n')
new_data=""
with open(r"C:\Users\Administrator\Desktop\txet.txt","r",encoding="utf-8") as f:
a = f.readlines()
# print(a)
......@@ -14,3 +15,8 @@ with open(r"C:\Users\Administrator\Desktop\txet.txt","r",encoding="utf-8") as f:
# print(a)
if "小兰:12本" in i:
print("数据在里面")
data = data.replace("小兰:12本","小兰:52本")
new_data = new_data+data
print(new_data)
with open(r"C:\Users\Administrator\Desktop\txet.txt","w",encoding="utf-8") as f:
f.write(new_data)
\ 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