Commit f7234a41 by BellCodeEditor

save project

parent 718bd5b3
Showing with 9 additions and 5 deletions
......@@ -8,7 +8,11 @@
# with open(r'C:\Users\Administrator\Desktop\shoucheng.txt','a',encoding='utf-8') as kunkun:
# kunkun.write('小兰:12本\n')
# kunkun.write('小丽:11本\n')
# with open(r'C:\Users\Administrator\Desktop\shoucheng.txt','r',encoding='utf-8') as kunkun:
# for data in kunkun:
# if '小兰:12本' in data:
#print("data")
\ No newline at end of file
new_data=''
with open(r'C:\Users\Administrator\Desktop\shoucheng.txt','r',encoding='utf-8') as kunkun:
for data in kunkun:
if '小兰:12本' in data:
data=data.replace('小兰:12本','小兰:14本')
new_data+=data
with open(r'C:\Users\Administrator\Desktop\shoucheng.txt','w',encoding='utf-8') as kunkun:
kunkun.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