Commit eaa03d01 by BellCodeEditor

save project

parent 16013d7a
Showing with 7 additions and 5 deletions
......@@ -5,8 +5,11 @@ with open(r'C:\Users\win 10\Desktop\po.txt','w',encoding='utf-8') as po:
po.write('李明:15\n')
with open(r'C:\Users\win 10\Desktop\po.txt','a',encoding='utf-8') as po:
po.write('小兰:12\n')
new=''
with open(r'C:\Users\win 10\Desktop\po.txt','r',encoding='utf-8') as po:
for data in po:
if '小兰:12' in data:
print('zai')
\ No newline at end of file
for d in po:
if '小兰:12' in d:
d=d.replace('小兰:12','小兰:15')
new+=d
with open(r'C:\Users\win 10\Desktop\po.txt','w',encoding='utf-8') as po:
po.write(new)
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