Commit a62a24ee by BellCodeEditor

auto save

parent 000df666
Showing with 4 additions and 2 deletions
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
#file=open(r"C:\Users\Administrator\Desktop\新建文件夹 (2)\book.txt","w",encoding="utf-8") #file=open(r"C:\Users\Administrator\Desktop\新建文件夹 (2)\book.txt","w",encoding="utf-8")
#file.write('小兰:12本') #file.write('小兰:12本')
#file.close() #file.close()
with open(r"C:\Users\Administrator\Desktop\新建文件夹 (2)\book.txt","w",encoding="utf-8") as file: with open(r"C:\Users\Administrator\Desktop\新建文件夹 (2)\book.txt","r",encoding="utf-8") as file:
file.write('小美:12本') for date in file:
if '小兰:12本' in date:
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