Commit 1e905e89 by BellCodeEditor

save project

parent 0e1f0236
Showing with 6 additions and 2 deletions
...@@ -2,5 +2,9 @@ ...@@ -2,5 +2,9 @@
# a=open(r'D:\DESK\test.txt',"w",encoding="utf-8") # a=open(r'D:\DESK\test.txt',"w",encoding="utf-8")
# a.write("小丽:11本") # a.write("小丽:11本")
# a.write("张伟:16本\n") # a.write("张伟:16本\n")
with open(r'D:\DESK\test.txt',"a",encoding="utf-8") as a: # with open(r'D:\DESK\test.txt',"a",encoding="utf-8") as a:
a.write("小兰:12本\n") # a.write("小兰:12本\n")
with open(r'D:\DESK\test.txt',"r",encoding="utf-8") as a:
for data in a:
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