<br><br><div class="gmail_quote">On Sun, Apr 15, 2012 at 5:51 AM, Chris Angelico <span dir="ltr"><<a href="mailto:rosuav@gmail.com">rosuav@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
(You may also want to consider using the 'with' statement to guarantee<br>
a timely closing of the file. Outside the scope of this mail though.)<br>
<br>I think this list is just to collect unique entries, yes? If so, a set<br>
may be more to your liking. Check out:<br>
<a href="http://docs.python.org/py3k/library/stdtypes.html#set" target="_blank">http://docs.python.org/py3k/library/stdtypes.html#set</a><br>
<br>
<span class="HOEnZb"><font color="#888888"><a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank"></a></font></span></blockquote><div><br>In cases like this I like to just show the final code after making all the changes, and let the student ask questions :)<br>
<br>with open('/bah') as res_own_file:<br>    all_res = set(line.strip().replace(' ', '').split(':')[1] for line in res_own_file if ':' in line)<br></div></div><br>-- <br>~Zahlman {:><br>