On Sun, Apr 15, 2012 at 5:51 AM, Chris Angelico <ros...@gmail.com> wrote:

>
> (You may also want to consider using the 'with' statement to guarantee
> a timely closing of the file. Outside the scope of this mail though.)
>
> I think this list is just to collect unique entries, yes? If so, a set
> may be more to your liking. Check out:
> http://docs.python.org/py3k/library/stdtypes.html#set
>
>  <http://mail.python.org/mailman/listinfo/python-list>


In cases like this I like to just show the final code after making all the
changes, and let the student ask questions :)

with open('/bah') as res_own_file:
    all_res = set(line.strip().replace(' ', '').split(':')[1] for line in
res_own_file if ':' in line)

-- 
~Zahlman {:>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to