Commit 47247e5c by BellCodeEditor

save project

parent 24a1f494
Showing with 10 additions and 2 deletions
...@@ -8,7 +8,15 @@ ...@@ -8,7 +8,15 @@
# q.write("小兰:12本\n小丽:11本\n李文:9本\n张伟:16本") # q.write("小兰:12本\n小丽:11本\n李文:9本\n张伟:16本")
# #a.close() # #a.close()
# for i in # for i in
w=""
with open(r'C:\Users\Administrator\Desktop\a.txt','r',encoding='utf-8') as q: with open(r'C:\Users\Administrator\Desktop\a.txt','r',encoding='utf-8') as q:
for i in q : for i in q :
if "李文:9本" in i: if "张伟:16本" in i:
print("有") i=i.replace("张伟:16本","张伟:1本")
w=w+i # w+=i
#print("有")
with open(r'C:\Users\Administrator\Desktop\a.txt','w',encoding='utf-8') as q:
q.write(w)
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