Commit 01ad37a9 by BellCodeEditor

save project

parent 24bcdc48
Showing with 4 additions and 14 deletions
new_data='' file1=open(r"C:\Users\Administrator\Desktop\test.txt","w",encoding="utf-8")
with open(r'C:\Users\Administrator\Desktop\book.txt','r',encoding='utf-8')as file1: file1.write("侯逸凡:1本\n")
for data in file: file1.close()
if'小强:10本'in data: \ No newline at end of file
data=data.replace('小强:10本','小强:11本')
if'小兰:12本'in data:
data=data.replace('小兰:12本','小兰:14本')
new_data+=data
with open(r'C:\Users\Administrator\Desktop\book.txt','w',encoding='utf-8')as file1:
file1.write(new_data)
with open(r'C:\Users\Administrator\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