Commit 3f8fd8c6 by BellCodeEditor

save project

parent f1eb4ba1
Showing with 9 additions and 5 deletions
# 写入同学们的捐赠明细:'小强:100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
with open("C:\\Users\\EDZ\\Desktop\\txt",'r',encoding='utf-8') as f:
a=f.read()
for i in a:
if i=='小强:100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b本'
print('找到了')
new_data=""
with open("C:\\Users\\EDZ\\Desktop\\test.txt",'r',encoding='utf-8') as f:
for data in f:
if '小强:10本' in data:
data=data.replace('小强:10本','小强:11本')
new_data +=data
with open("C:\\Users\\EDZ\\Desktop\\test.txt",'r',encoding='utf-8') as f:
f.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