Commit 3abc30f3 by BellCodeEditor

save project

parent 7b6b2dff
Showing with 8 additions and 4 deletions
a=''
with open(r"C:\Users\Windows 10\Desktop\book.txt","r",encoding="utf-8") as file:
for i in file:
if '小强:10本' in i:
print('小强在')
i= i.replace('小强:10本','小强:11本')
if '小兰:12本' in i:
print('小兰在')
\ No newline at end of file
i= i.replace('小兰:12本','小兰:14本')
a+=i
with open(r"C:\Users\Windows 10\Desktop\book.txt","w",encoding="utf-8") as file:
file.write(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