<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 16, 2015 at 1:44 PM, Richard Purdie <span dir="ltr"><<a href="mailto:richard.purdie@linuxfoundation.org" target="_blank">richard.purdie@linuxfoundation.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":4nx" class="a3s" style="overflow:hidden">- for f in fl.split():<br>
+ fl = fl.strip()<br>
+ while fl:<br>
+ # A .split() would be simpler but means spaces or colons in filenames would break<br>
+ a = fl.find(":True")<br>
+ b = fl.find(":False")<br>
+ if ((a < 0) and b) or ((b > 0) and (b < a)):<br>
+ f = fl[:b+6]<br>
+ fl = fl[b+7:]<br>
+ elif ((b < 0) and a) or ((a > 0) and (a < b)):<br>
+ f = fl[:a+5]<br>
+ fl = fl[a+6:]<br>
+ else:<br>
+ break<br>
+ fl = fl.strip()</div></blockquote></div><br>Hmm, another option would be to re.split('(:(True|False))', fl). When the pattern you're splitting on is grouped, it's kept in the results, so you'd get a list of file, :True/False, next file, :True/False, ..</div><div class="gmail_extra">-- <br><div class="gmail_signature">Christopher Larson<br>clarson at kergoth dot com<br>Founder - BitBake, OpenEmbedded, OpenZaurus<br>Maintainer - Tslib<br>Senior Software Engineer, Mentor Graphics</div>
</div></div>