<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 12, 2013 at 7:07 AM, Stefan Stanacar <span dir="ltr"><<a href="mailto:stefanx.stanacar@intel.com" target="_blank">stefanx.stanacar@intel.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":zs" style="overflow:hidden">+ total = ''<br>
with open(default_file, 'r') as f:<br>
- contents = f.readlines()<br>
- f.close()<br>
-<br>
- total = ""<br>
- for c in contents:<br>
- total += c<br>
+ for line in f:<br>
+ total += line<br>
<br>
total += "#added by hob"<br>
total += "\n%s += \"%s\"\n" % (var, val)<br>
<br>
with open(default_file, 'w') as f:<br>
f.write(total)<br>
- f.close()</div></blockquote></div><br>This is weird. Have they ever heard of opening a file in append mode? :) And obviously, splitting the contents into lines, then re-concatenating those lines into a string blob makes no sense either.<br>
-- <br>Christopher Larson<br>clarson at kergoth dot com<br>Founder - BitBake, OpenEmbedded, OpenZaurus<br>Maintainer - Tslib<br>Senior Software Engineer, Mentor Graphics
</div></div>