Commit b60f7bed by BellCodeEditor

save project

parent 89aa2b99
Showing with 9 additions and 4 deletions
filel=open(r'C:\Users\Administrator\Desktop\test.txt','w',encoding='utf-8')
filel.write('小兰:12本')
filel.write('小丽:11本')
filel.write('李文:9本')
filel.write('张伟:16本')
filel.write('小兰:12本\n')
filel.write('小丽:11本\n')
filel.write('李文:9本\n')
filel.write('张伟:16本\n')
filel.close()
file=open(r'C:\Users\Administrator\Desktop\test.txt','a',encoding='utf-8')
file.write('小兰:1200本\n')
file.close()
with open(r'C:\Users\Administrator\Desktop\test.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