Commit a1d6922e by BellCodeEditor

save project

parent 70eacebb
Showing with 6 additions and 2 deletions
...@@ -8,7 +8,11 @@ ...@@ -8,7 +8,11 @@
# file1.write('蟑螂:10本\n') # file1.write('蟑螂:10本\n')
# file1.write('张暗:16本\n') # file1.write('张暗:16本\n')
# file1.close() # file1.close()
new_data=''
with open(r'C:\Users\Administrator\Desktop\uhdog.txt','r',encoding='utf-8')as file1: with open(r'C:\Users\Administrator\Desktop\uhdog.txt','r',encoding='utf-8')as file1:
for data in file1: for data in file1:
if '大兰:12本' in data: if '大兰:12本' in data:
print("在") data=data.replace('大兰:12本','大兰:14本')
\ No newline at end of file new_data+=data
with open(r'C:\Users\Administrator\Desktop\uhdog.txt','w',encoding='utf-8')as file1:
file1.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