Commit b6a08460 by BellCodeEditor

save project

parent 63f04258
Showing with 8 additions and 4 deletions
...@@ -10,8 +10,11 @@ ...@@ -10,8 +10,11 @@
#file1.write('小强:12本\n') #file1.write('小强:12本\n')
#file1.write('李明:15本\n') #file1.write('李明:15本\n')
#file1.cloes() #file1.cloes()
new_data=''
with open=(r'C:\Users\Administrator\Desktop\test.txt','a',encoding='utf-8')as file1: with open=(r'C:\Users\Administrator\Desktop\test.txt','r',encoding='utf-8')as file1:
for i in fiel: for i in fiel:
if'小强=10本'in i: if'小强=10本'in i:
print ('数据在文件中') i=i.replace('小强:10本','小强:11本')
i=i.replace('小兰:12本','小兰:14本')
new_data +=i
print(i)
\ 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