Commit fa6b42d0 by BellCodeEditor

save project

parent 12b962a7
Showing with 13 additions and 0 deletions
...@@ -2,3 +2,16 @@ ...@@ -2,3 +2,16 @@
with open(r'C:\Users\Administrator\Desktop\test.txt','a',encoding='utf-8')as file1: with open(r'C:\Users\Administrator\Desktop\test.txt','a',encoding='utf-8')as file1:
file1.write('小强:12本\n') file1.write('小强:12本\n')
file1.write('李明:15本\n') file1.write('李明:15本\n')
file1=open(r'C:\Users\Administrator\Desktop\test.txt','a',encoding='utf-8')
file1.write('小丽:10')
file1.close()#追加
file1=open(r'C:\Users\Administrator\Desktop\test.txt','r',encoding='utf-8')
a=file1.read()
print(a)
file1.close()#读取
with open(r'C:\Users\Administrator\Desktop\test.txt','r',encoding='utf-8')as file1:
for data in file1:
if '小丽:10' in data:
print("存在")
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