Commit b5bde26b by BellCodeEditor

save project

parent a6de9d1c
Showing with 5 additions and 4 deletions
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
#fill1.open(r'C:\Users\86175\Desktop\book.text''w',encoding=utf-8) #fill1.open(r'C:\Users\86175\Desktop\book.text''w',encoding=utf-8)
#fill1.write('小兰:12本\n小丽:11本\n李文:9本\n张伟:16本') #fill1.write('小兰:12本\n小丽:11本\n李文:9本\n张伟:16本')
#fill1.close() #fill1.close()
new_data=''
with open(r'C:\Users\86175\Desktop\book.txt','r',encoding='utf-8')as fill2: with open(r'C:\Users\86175\Desktop\book.txt','r',encoding='utf-8')as fill2:
for date in fill2: for data in fill2:
if '小强:10本' in date if '小强' in data
print() data.replace('小强:10本''小强:11本')
\ No newline at end of file new_data +=data
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