Commit 1e9aca33 by BellCodeEditor

auto save

parent 27c4f953
Showing with 8 additions and 3 deletions
file= open(r'C:\Users\CM\Desktop\book.txt','a',encoding='utf-8')
file.write('小强:10本\n')
file.write('李明:10本\n')
with open(r'C:\Users\CM\Desktop\book.txt','r',encoding='utf-8') as file:
#file.write('小强:10本\n')
#file.write('李明:10本\n')
for data in file:
if "小强:10本" in data:
if "小兰:10本" in data:
print("数据在文件中")
file.close()
\ 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