Commit 7216e9c8 by BellCodeEditor

save project

parent 1e8d8f2d
Showing with 6 additions and 3 deletions
with open('C:\\Users\\john\\Desktop\\tv.txt','a',encoding='utf-8') as file1:
file1.write('小兰:12\n小丽:11\n李文:9\n张伟:16')
with open('C:\\Users\\john\\Desktop\\tv.txt','r',encoding='utf-8') as file1:
for date in file1:
if '张伟:16' in date:
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