Commit acab1206 by BellCodeEditor

save project

parent b7c5be9c
Showing with 7 additions and 5 deletions
...@@ -2,11 +2,13 @@ ...@@ -2,11 +2,13 @@
# bai=open(r"C:\Users\Administrator\Desktop\王白\wang.txt","w",encoding="utf-8") # bai=open(r"C:\Users\Administrator\Desktop\王白\wang.txt","w",encoding="utf-8")
# bai.write("小兰:12本\n小丽:11本") # bai.write("小兰:12本\n小丽:11本")
# bai.close() # bai.close()
bai2 = ""
with open(r"C:\Users\Administrator\Desktop\王白\wang.txt","r",encoding="utf-8") as bai: with open(r"C:\Users\Administrator\Desktop\王白\wang.txt","r",encoding="utf-8") as bai:
a=bai.read() a=bai.read()
for i in a: for i in a:
if "bai:10" in i: if "小兰:12本" in i:
print("found") i.replace("小兰:12本","小兰:14本")
bai2+=i
else: else:
print("Lost") bai2+=i
break print(bai2)
\ No newline at end of file \ 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