Commit 91ce2af3 by BellCodeEditor

save project

parent cd1be9f1
Showing with 11 additions and 3 deletions
...@@ -5,6 +5,13 @@ ...@@ -5,6 +5,13 @@
# file1.write('李文:9本\n') # file1.write('李文:9本\n')
# file1.write('张伟:16本\n') # file1.write('张伟:16本\n')
# file1.close() # file1.close()
with open(r'C:\Users\w\Desktop\pig.text','a',encoding='utf-8') as file1: #with open(r'C:\Users\w\Desktop\pig.text','a',encoding='utf-8') as file1:
file1.write('徐安迪:20本\n') #file1.write('徐安迪:20本\n')
new_data=''
with open(r'C:\Users\w\Desktop\pig.text','r',encoding='utf-8') as file1:
for data in file1:
if '小丽:11本' in data:
new_data+=data
print(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