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 ]