Commit 5d9a5a8d by BellCodeEditor

auto save

parent 7e3a2ff3
Showing with 16 additions and 0 deletions
# 写入同学们的捐赠明细:'小兰:12本'、'小丽:11本'、'李文:9本'、'张伟:16本' # 写入同学们的捐赠明细:'小兰:12本'、'小丽:11本'、'李文:9本'、'张伟:16本'
#开
# file1=open(r'C:\Users\Administrator\Desktop\shuben.txt',"w",encoding='utf-8')
# #放
# file1.write("小兰:12本\n") #\n等于回车就是换行符
# file1.write("小贝:0.5本\n")
# file1.write("小丽:70本\n")
# file1.write("张伟:2本\n")
# #关
# file1.close()
with open(r'C:\Users\Administrator\Desktop\shuben.txt','r',encoding='utf-8') as file2:
for i in file2:
if "小兰:12本" in i:
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