Commit 348f7104 by BellCodeEditor

save project

parent be01f616
Showing with 6 additions and 1 deletions
...@@ -5,6 +5,11 @@ file1.write("小丽:11本\n") ...@@ -5,6 +5,11 @@ file1.write("小丽:11本\n")
file1.close() file1.close()
with open(r"C:\Users\admin\Desktop\text.txt","a",encoding="utf-8") as file1: with open(r"C:\Users\admin\Desktop\text.txt","a",encoding="utf-8") as file1:
file1.write("李文:9本\n") file1.write("李文:9本\n")
with open(r"C:\Users\admin\Desktop\text.txt","a",encoding="utf-8") as file1: with open(r"C:\Users\admin\Desktop\text.txt","r",encoding="utf-8") as file1:
a=file1.read() a=file1.read()
print(a) print(a)
with open(r"C:\Users\admin\Desktop\text.txt","r",encoding="utf-8") as file1:
for i in file1:
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