Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.034 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'newbie': 0.05; 'json': 0.07; 'subject:file': 0.07; 'parsing': 0.09; 'worked.': 0.09; 'looping': 0.16; 'ravi': 0.16; 'wrote:': 0.18; 'split': 0.19; 'string,': 0.24; 'header:In-Reply-To:1': 0.27; 'to:2**1': 0.27; "doesn't": 0.30; 'subject:list': 0.30; 'message- id:@mail.gmail.com': 0.30; 'work.': 0.31; 'file': 0.32; 'thanks!': 0.32; 'third': 0.33; 'subject:from': 0.34; 'convert': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'method': 0.36; 'list': 0.37; 'to:addr:python-list': 0.38; 'list,': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; '2nd': 0.60; 'first': 0.61; 'to:addr:gmail.com': 0.65; 'subject:read': 0.84; 'items,': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=GWQHivhnBLAbsygcJvZWXxYmerE2FggVBo8cWlecdH4=; b=sJm4Wnl0fVJc3VwAaJ18N6b3Qcb96mftGsFQktL7sG7D3J/RV4UeHB4NxB+h2u/hLN htxVQjlJlhnmVoxqlZDL1RXbNiyWVCY195isCrexgYCjtHGSh0t+NyDIv18DaEZlyNut 4f4t7xsKsZfUKxDPAHc95ZvXwEYVFqZUoxO7IZEBANMv8i48UGMFlcfuwWGQED+52c/t 7746fEUGqaH7a1sBbb+g5hX8nPje80pt+7PgmmYHGoAWr3J27Fjk6GRzqVQCBe64MGRg 1TLEBpSZSEgGayaHOWtMjJrS06VTSeh2jC6nM1D3n7Dk+8NS7AuaN5WyWO8iU769oDh9 s2Hg== X-Received: by 10.66.168.7 with SMTP id zs7mr2880157pab.152.1381081144688; Sun, 06 Oct 2013 10:39:04 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <236e2bfa-94a2-4c6b-a6e7-7105370375fc@googlegroups.com> References: <236e2bfa-94a2-4c6b-a6e7-7105370375fc@googlegroups.com> From: Ravi Sahni Date: Sun, 6 Oct 2013 23:08:43 +0530 Subject: Re: how to read list from file To: Harvey Greenberg , python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1381082860 news.xs4all.nl 15968 [2001:888:2000:d::a6]:53689 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:56274 On Sun, Oct 6, 2013 at 10:27 PM, Harvey Greenberg 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