Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #56274

Re: how to read list from file

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 <ganeshsahni07@gmail.com>
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 <fbc6e512-88fa-4de0-80d3-6757fcc52af4@googlegroups.com> <236e2bfa-94a2-4c6b-a6e7-7105370375fc@googlegroups.com>
From Ravi Sahni <ganeshsahni07@gmail.com>
Date Sun, 6 Oct 2013 23:08:43 +0530
Subject Re: how to read list from file
To Harvey Greenberg <hjgreenberg@gmail.com>, 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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.790.1381082860.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Sun, Oct 6, 2013 at 10:27 PM, Harvey Greenberg <hjgreenberg@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

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

how to read list from file Harvey Greenberg <hjgreenberg@gmail.com> - 2013-10-05 18:08 -0700
  Re: how to read list from file Tim Chase <python.list@tim.thechases.com> - 2013-10-05 20:24 -0500
    Re: how to read list from file Roy Smith <roy@panix.com> - 2013-10-05 21:35 -0400
    Re: how to read list from file Harvey Greenberg <hjgreenberg@gmail.com> - 2013-10-06 09:41 -0700
      Re: how to read list from file Harvey Greenberg <hjgreenberg@gmail.com> - 2013-10-06 09:46 -0700
      Re: how to read list from file Ravi Sahni <ganeshsahni07@gmail.com> - 2013-10-06 22:20 +0530
      Re: how to read list from file Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-10-07 09:04 +0300
  Re: how to read list from file Roy Smith <roy@panix.com> - 2013-10-05 21:34 -0400
  Re: how to read list from file Terry Reedy <tjreedy@udel.edu> - 2013-10-06 02:24 -0400
  Re: how to read list from file Harvey Greenberg <hjgreenberg@gmail.com> - 2013-10-06 09:57 -0700
    Re: how to read list from file Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-06 18:24 +0100
    Re: how to read list from file Ravi Sahni <ganeshsahni07@gmail.com> - 2013-10-06 23:08 +0530

csiph-web