Commit b7114347 by BellCodeEditor

save project

parent 6907b8c3
Showing with 12 additions and 4 deletions
fell=open(r"C:\Users\23636\Desktop\toom.txt","w",encoding="uft-8") # 写入同学们的捐赠明细:'小兰:12本'、'小丽:11本'、'李文:9本'、'张伟:16本'
fell.w('小强:10本/n') # fell=open(r"C:\Users\23636\Desktop\toom.txt","w",encoding="utf-8")
fell.w('小兰:11本/n') # fell.write('小兰:12本\n')
fell.close() # fell.write('小丽:11本\n')
# fell.close()
with open(r"C:\Users\23636\Desktop\toom.txt","r",encoding="utf-8") as fell:
for data in fell:
if '小强: 10本' in data:
print('数据在文件中')
if '小兰: 12本' 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