Commit 773ac05b by BellCodeEditor

auto save

parent dae92a5d
Showing with 11 additions and 1 deletions
# 写入同学们的捐赠明细:'小兰:12本'、'小丽:11本'、'李文:9本'、'张伟:16本' with open(r"c:\Users\admin\Desktop\test.txt","w",encoding="uft-8")as file
file.write("小王:12本\n小江:20本\n")
with open(r"c:\Users\admin\Desktop\test.txt","a",encoding="uft-8")as file
file.write("小明:12本\n")
with open(r"c:\Users\admin\Desktop\test.txt","r",encoding="uft-8")as file
a=qwe.read()
print(a)
with open(r"c:\Users\admin\Desktop\test.txt","r",encoding="uft-8")as file
for data in file:
if"小江,20本"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