Commit 343af581 by BellCodeEditor

save project

parent 56c87d64
Showing with 7 additions and 3 deletions
...@@ -4,5 +4,9 @@ a.write("小强:12本,李明:15本") ...@@ -4,5 +4,9 @@ a.write("小强:12本,李明:15本")
a.close() a.close()
with open(r"C:\Users\EDZ\Desktop\book.txt","a",encoding="utf-8") as a: #with open(r"C:\Users\EDZ\Desktop\book.txt","a",encoding="utf-8") as a:
a.write("小强:12本,李明:15本") #a.write("小强:12本,李明:15本")
\ No newline at end of file with open(r"C:\Users\EDZ\Desktop\book.txt","r",encoding="utf-8") as a:
for data in a:
if "小强:12本" in data:
print('数据在文件中')
\ No newline at end of file
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