Commit 85e494b5 by BellCodeEditor

save project

parent 0aa543cb
Showing with 6 additions and 3 deletions
......@@ -5,16 +5,19 @@
# file1.write('小方:5本')
# file1.write('小高:20本')
# file1.close()
new_data=
with open(r'C:\users\CM\Desktop\test.txt','r',encoding='utf-8') as file1:
for data in file1:
for data in file1:
if'小兰:12本' in data:
data=data.replace('小兰:12本','小兰:14本')
new_data+=data
print('数据在文件中')
file1.write('小兰:12本')
a=file.read()
print(a)
with open(r'C:\users\CM\Desktop\test.txt','r',encoding='utf-8') as file1:
file1.write(new_data)
......
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