how to read list from file

Ravi Sahni ganeshsahni07 at gmail.com
Sun Oct 6 13:38:43 EDT 2013


On Sun, Oct 6, 2013 at 10:27 PM, Harvey Greenberg <hjgreenberg at gmail.com> wrote:
> On Saturday, October 5, 2013 7:08:08 PM UTC-6, Harvey Greenberg wrote:
>> I am looping as for L in file.readlines(), where file is csv.
>>
>>
>>
>> L is a list of 3 items, eg, [{'a':1, 'b':2}, [1,2,3], 10] Note that the first item is a dir and 2nd is a list, so parsing with split doesn't work.  Is there a way to convert L, which is a string, to the list of 3 items I want?
>
> Yay!!!! It worked.  Thanks!

Which method working?
Literal_eval method? JSON method? Some third method?

[I am newbie so interested. Please to excuse!!]
-- 
Ravi



More information about the Python-list mailing list