Chris McDonough wrote:

> L = []
> [L.append(line) for line in (open('filename.txt')]

Ouch.

Did you perhaps mean:

L = [ line for line in open('filename.txt') ]

Or, with better error handling:

try:
    f = open('filename.txt')
except IOError:
    # handle error here
else:
    L = [ line for line in f ]

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to