Commit 7454eb15 by BellCodeEditor

save project

parent ac65a94b
Showing with 3 additions and 2 deletions
...@@ -8,9 +8,9 @@ new_file='' ...@@ -8,9 +8,9 @@ new_file=''
with open(r'C:\Users\Makcoo-Bellcode\Desktop\book.txt','r',encoding='utf-8')as file: with open(r'C:\Users\Makcoo-Bellcode\Desktop\book.txt','r',encoding='utf-8')as file:
for data in file: for data in file:
if '小强:10本' in data: if '小强:10本' in data:
data.replace('小强:10本','小强:11本') data=data.replace('小强:10本','小强:11本')
if '小兰:12本' in data: if '小兰:12本' in data:
data.replace('小兰:12本','小兰:14本') data=data.replace('小兰:12本','小兰:14本')
new_file+=data new_file+=data
with open(r'C:\Users\Makcoo-Bellcode\Desktop\book.txt','w',encoding='utf-8')as file: with open(r'C:\Users\Makcoo-Bellcode\Desktop\book.txt','w',encoding='utf-8')as file:
file.write(new_file) file.write(new_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