Commit 07d2d744 by BellCodeEditor

save project

parent ab742354
Showing with 11 additions and 6 deletions
小赵:99999999999999999999999999999999999999999999999999999999999999999999999999999999 小赵:9本
小猪:99999999999999999999999999999999999999999999999999999999999999999999999999999999 小猪:9本
f=open(r'2.txt','w',encoding='utf-8') f=open(r'2.txt','w',encoding='utf-8')
f.write("小赵:99999999999999999999999999999999999999999999999999999999999999999999999999999999\n") f.write("小赵:9本\n")
f.write("小猪:99999999999999999999999999999999999999999999999999999999999999999999999999999999\n") f.write("小猪:9本\n")
f.close() f.close()
new_data =""
with open(r'2.txt','r',encoding='utf-8')as f: with open(r'2.txt','r',encoding='utf-8')as f:
for data in f: for data in f:
if "小猪:99999999999999999999999999999999999999999999999999999999999999999999999999999999本" in data: if "小猪:9本" in data:
print("存在") print("存在")
data=data.replace("小猪:9本","小猪:19本")
new_data = new_data+data
with open(r'2.txt','w',encoding='utf-8') as f:
f.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