Commit 60f5d0f1 by BellCodeEditor

save project

parent 584d929b
Showing with 15 additions and 16 deletions
f=open(r'2.txt','w',encoding='utf-8') score={'bjs':91,'bls':88,'bks':85}
f.write("小赵:9本\n")
f.write("小猪:9本\n")
f.close()
new_data ="" for i in score:
with open(r'2.txt','r',encoding='utf-8')as f: print(i)
for data in f: for key in score.keys():
if "小猪:9本" in data: print(key)
print("存在") for value in score.values():
data=data.replace("小猪:9本","小猪:19本") print(value)
new_data = new_data+data for key,value in score.items():
print(key,value)
with open(r'2.txt','w',encoding='utf-8') as f: \ No newline at end of file
f.write(new_data)
\ No newline at end of file
score={'bjs':91,'bls':88,'bks':85}
score={'bjs':91,'bls':88,'bks':85}
for i in score:
print(i)
\ 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