Commit 42bd0b5d by BellCodeEditor

save project

parent a8d02629
Showing with 18 additions and 0 deletions
with open(r"C:\Users\Windows 10\Desktop\wasd.txt",'w',encoding='UTF-8')as wasd:
wasd.write('小兰:12本\n')
wasd.write('小丽:11本\n')
wasd.write('李文:9本\n')
wasd.write('张伟:16本\n')
new_dsb=''
with open(r"C:\Users\Windows 10\Desktop\wasd.txt",'r',encoding='UTF-8')as wasd:
for dsb in wasd:
if'张伟:16本'in dsb:
dsb=dsb.replace('张伟:16本','张伟:17本')
if'小兰:12本'in dsb:
dsb=dsb.replace('小兰:12本','小兰:14本')
new_dsb+=dsb
print(new_dsb)
with open(r"C:\Users\Windows 10\Desktop\wasd.txt",'w',encoding='UTF-8')as wasd:
wasd.write(new_dsb)
\ 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