Commit 84896e2b by BellCodeEditor

save project

parent 8097fb73
Showing with 12 additions and 3 deletions
with open(r'C:\Users\玛酷机器人\Desktop\book.txt','a',encoding='utf-8')as file: new_data=""
file.write('小兰:12本\n') with open(r'C:\Users\玛酷机器人\Desktop\book.txt','r',encoding='utf-8')as file1:
\ No newline at end of file for data in file1:
if '小兰:12本'in data:
data=data.replace('小兰:12本\n','小兰:14本\n')
new_data +=data
with open(r'C:\Users\玛酷机器人\Desktop\book.txt','w',encoding='utf-8')as file1:
file1.write(new_data)
with open(r'C:\Users\玛酷机器人\Desktop\book.txt','r',encoding='utf-8')as file1:
a=file1.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