Commit f3bee832 by BellCodeEditor

save project

parent ac8214d7
Showing with 11 additions and 7 deletions
file=open(r"C:\Users\paulb\Desktop\test.txt",'w',encoding='utf-8')
file.write('小明:20\n小红:11\n小李:15\n')
file.close()
file=open(r"C:\Users\paulb\Desktop\test.txt",'a',encoding='utf-8')
file.write('小强:12\n小张:18\n小二:13\n')
file.close()
\ No newline at end of file
##file=open(r"C:\Users\paulb\Desktop\test.txt",'w',encoding='utf-8')
##file.write('小明:20\n小红:11\n小李:15\n')
##file.close()
##file=open(r"C:\Users\paulb\Desktop\test.txt",'a',encoding='utf-8')
##file.write('小强:12\n小张:18\n小二:13\n')
##file.close()
with open(r"C:\Users\paulb\Desktop\test.txt",'w',encoding='utf-8'):
for data in file:
if "小强:12" and "小二:13" 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