Commit 3ebf4727 by BellCodeEditor

save project

parent 5b5812d8
Showing with 11 additions and 4 deletions
...@@ -12,7 +12,14 @@ ...@@ -12,7 +12,14 @@
with open(r'C:\Users\Administrator\Desktop\book.txt','r',encoding='utf-') as filel: with open(r'C:\Users\Administrator\Desktop\book.txt','r',encoding='utf-') as filel:
for data in filel: for data in filel:
if '小强:10本' in data: if '小强:10本'in data:
print('在') data=data.replce('小强:10本','小兰:12本')
if '小兰:12本' in data: if '小兰:12本' in data:
print('在') data=data.replce('小兰:12本','小兰:14本')
\ No newline at end of file new_data +=data
with open((r'C:\Users\Administrator\Desktop\book.txt','w',encoding='utf-') as filel:
filel.write(new_data)
with open((r'C:\Users\Administrator\Desktop\book.txt','r',encoding='utf-') as filel:
a=filel.read()
print(a)
\ 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