Commit c9e149bc by BellCodeEditor

save project

parent 054d3cd9
Showing with 7 additions and 3 deletions
......@@ -12,13 +12,17 @@
#file.close()
new_data=''
with open(r'C:\Users\admin\Desktop\111\222.txt','r',encoding='utf-8')as file:
for data in file:
if '李文:9本' in data:
if'李文:9本' in data:
data=data.replace('李文:9本','李文:11本')
new_data +=data
print('数据在文件中')
with open(r'C:\Users\admin\Desktop\111\222.txt','w',encoding='utf-8')as file:
file.write(new_data)
print()
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