Commit 8fe1da8a by BellCodeEditor

save project

parent 99970ec6
Showing with 7 additions and 2 deletions
"""fil1=open(r'C:\Users\LENOVO\Desktop\test.txt','a',encoding='utf-8')
fil1.write('小兰:12本\n')
fil1.close()"""
with open(r'C:\Users\LENOVO\Desktop\test.txt','r',encoding='utf-8')as file: with open(r'C:\Users\LENOVO\Desktop\test.txt','r',encoding='utf-8')as file:
for date in file: for data in file:
if '小强:10本'in date: if '小强:12本' in data:
print('数据在文件中') 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