Commit ac09e3d1 by BellCodeEditor

save project

parent c9cdecdb
Showing with 10 additions and 3 deletions
...@@ -8,7 +8,14 @@ ...@@ -8,7 +8,14 @@
#file1=open(r'C:\Users\Administrator\Desktop\test.txt','a',encoding='utf-8') #file1=open(r'C:\Users\Administrator\Desktop\test.txt','a',encoding='utf-8')
#file1.write('小明:15本\n') #file1.write('小明:15本\n')
#file1.close() #1file1.close()
with open(r'C:\Users\Administrator\Desktop\test.txt','r',encoding='utf-8')as file1:
for data in file1:
if'小兰:12本'in data:
print('数据在文件中')
with open(r'C:\Users\Administrator\Desktop\test.txt','a',encoding='utf-8')as file1:
file1.write('SB:10000本')
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