Commit 51c3fc60 by BellCodeEditor

auto save

parent d2bb25f3
Showing with 6 additions and 0 deletions
...@@ -9,3 +9,8 @@ with open("C:\\Users\\Administrator\\Desktop\\test.txt",'a',encoding='utf-8') as ...@@ -9,3 +9,8 @@ with open("C:\\Users\\Administrator\\Desktop\\test.txt",'a',encoding='utf-8') as
file.write('小强:12本') file.write('小强:12本')
file.write('李明:15本') file.write('李明:15本')
with open("C:\\Users\\Administrator\\Desktop\\test.txt",'r',encoding='utf-8') as file: with open("C:\\Users\\Administrator\\Desktop\\test.txt",'r',encoding='utf-8') as file:
for data in file1:
if '小强:12本 ' in data:
data=data.replace('小强:12本','小强:13本')
new_data +=data
print(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