Commit 9f136c28 by BellCodeEditor

save project

parent 92c00a59
Showing with 8 additions and 4 deletions
# filel=open(r'C:\\Users\\Think\\Desktop\\text.txt','w',encoding='utf-8')
# filel.write('小兰:12本,小明:10本')
# filel.close()
filel=open(r'C:\\Users\\Think\\Desktop\\text.txt','a',encoding='utf-8')
filel.write('小兰:12本\n,小明:10本\n,口巴:15本\n')
filel.close()
\ No newline at end of file
# filel=open(r'C:\\Users\\Think\\Desktop\\text.txt','a',encoding='utf-8')
# filel.write('小兰:12本\n,小明:10本\n,口巴:15本\n')
# filel.close()
with open(r'C:\\Users\\Think\\Desktop\\text.txt','r',encoding='utf-8')as filel:
for data in filel:
if'小强:10本'in data:
print('数据在文件中')
\ 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