Commit a9e26bf9 by BellCodeEditor

save project

parent 2f7848df
Showing with 7 additions and 3 deletions
new_data = ''
with open(r'D:\deyauyfiuayfuay\test.txt','r',encoding='utf-8') as file_1:
for data in file_1:
if "李文" in data:
print("在数据里面!!")
print(data)
\ No newline at end of file
data=data.replace("李文:9本","李文:20本")
new_data += data
print(new_data)
with open(r'D:\deyauyfiuayfuay\test.txt','w',encoding='utf-8') as file_1:
file_1.write(new_data)
\ 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