Commit 4e372587 by BellCodeEditor

save project

parent 2b88de45
Showing with 8 additions and 9 deletions
...@@ -8,13 +8,12 @@ liu.close() ...@@ -8,13 +8,12 @@ liu.close()
with open(r"C:\Users\Administrator\Desktop\liu yu chen.txt","a",encoding="utf-8") as liu: with open(r"C:\Users\Administrator\Desktop\liu yu chen.txt","a",encoding="utf-8") as liu:
liu.write("小Q:12本\n") liu.write("小Q:12本\n")
liu.write("小A:18本\n") liu.write("小A:18本\n")
x=''
with open(r"C:\Users\Administrator\Desktop\liu yu chen.txt","r",encoding="utf-8") as liu: with open(r"C:\Users\Administrator\Desktop\liu yu chen.txt","r",encoding="utf-8") as liu:
for i in liu: for i in liu:
if '小强:10本' in i: if '小强:10本' in liu:
print("小强的数据在文档中") i = i.replace('小强:10','小强:11本')
if '小丽:11本' in i: if '小丽:11本' in liu:
print("小丽的数据在文档中") i = i.replace('小丽:11','小丽:14本')
if '李文:9本' in i: x +=i
print("李文的数据在文档中")
if '张伟:16本' in i: \ No newline at end of file
print("张伟的数据在文档中")
\ 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