嗨,我有一个下面的文件数据,我想处理它以获得预期的输出,只是想知道作为一个python学习者是否有办法实现这个基于开始和停止布尔索引。
在文件行中,用一个名为
SRV:
在某些情况下,这些行总是在同一行开始和结束,而在某些情况下,这些行被扩展为换行符。
文件文本数据:
SRV: this is for bryan
SRV: this is for terry
SRV: this is for torain
sec01: This is reserved
sec02: This is open for all
sec03: Closed!
SRV: this is for Jun
预期产量:
SRV: this is for bryan
SRV: this is for terry
SRV: this is for torain sec01: This is reserved sec02: This is open for all sec03: Closed!
SRV: this is for Jun
有没有更好的方法来达到这个目的,我对熊猫也没意见。