On May 9, 2:43 pm, HMS Surprise <[EMAIL PROTECTED]> wrote:
> > [lst.append(list(line.split())) for line in file]
>
> Thanks, this is the direction I wanted to go, BUT I must use v2.2 so
> the line above gives me the error:
>
> AttributeError: __getitem__
>
> But the write format will be helpful.

(change to file.xreadlines(). Btw that snippet will fail miserably for
most data).

Instead, use pickle:

import pickle
pickle.dump(lst_of_lst, open('outfile', 'wb'))
lst_of_lst = pickle.load(open('outfile', 'rb'))

-Mike

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

Reply via email to