Commit 60430fc7 by BellCodeEditor

save project

parent e84238ed
Showing with 10 additions and 10 deletions
file1=open(r"C:\Users\噜噜\Desktop\txt.txt",'w',encoding='utf-8')
file1.write('小兰:12本')
file1.close()
file1=open(r"C:\Users\噜噜\Desktop\txt.txt",'a',encoding='utf-8')
file1.write('小:12本')
file1.close()
file1=open(r"C:\Users\噜噜\Desktop\txt.txt",'r',encoding='utf-8')
for i in file1:
if '小兰:12本' in i:
print('ok')
st=' '
with open(r"C:\Users\噜噜\Desktop\txt.txt",'r',encoding='utf-8')as file1:
for i in file1:
if '小兰:12本' in i:
i=i.replace('小兰:12本','小兰:11本')
st+=i
with open(r"C:\Users\噜噜\Desktop\txt.txt",'w',encoding='utf-8')as file1:
file1.write(st)
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