原始文档如上图所示
代码如下所示
filepath = '../question.txt'
with open(filepath, encoding='utf-8') as lines:
for line in lines:
print('之前: ',line)
if line.strip() == "%":
break
for line in lines:
print('之后: ',line)
for line in lines:
print('最后', line)
输出是这样
不懂这个逻辑是怎么来的,如有高手请指教