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!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:file': 0.07; 'main()': 0.09; 'rows': 0.09; 'skip:# 30': 0.09; 'cc:addr:python- list': 0.11; 'python': 0.11; 'def': 0.12; '23,': 0.16; 'better?': 0.16; 'csv': 0.16; 'input:': 0.16; 'main():': 0.16; 'once.': 0.16; 'subject:CSV': 0.16; 'subject:Reading': 0.16; 'wrote:': 0.18; 'example': 0.22; 'import': 0.22; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'url:python': 0.33; 'skip:d 20': 0.34; 'received:209.85': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'url:listinfo': 0.36; 'url:org': 0.36; 'received:209': 0.37; 'starting': 0.37; 'thank': 0.38; 'pm,': 0.38; 'little': 0.38; 'explain': 0.39; '\xa0\xa0\xa0': 0.39; 'url:mail': 0.40; 'how': 0.40; 'to:addr:gmail.com': 0.65; 'to:charset:iso-8859-1': 0.74; 'ana': 0.84; '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=Gz/njE5wsW2uvx7sigkVGp0pM1fZ9vB30tGg2WVEXsk=; b=l7ZRgIS5bSP2jNKEzMKa0InsEcyn87ZNR5V5N70xm8I712qwldxj/KbIvqLNX9LibN FqvXqIifQesu6i9KHPr74HQlAxMJ3B1hhhIaAYetJgST4T8ihjN1wyBA//a3ZPfXoSpM 2YNGdXBHwdKfHFauL00Gecdw/iKoNCHyAJ3BwWV15hlQDRkdhV/F/F4Ak0nHEEJkHJT7 E1iqr+MqLiCeSseaLesUl/D1Xgbu8SEbQ6+tosLEBBtgOs+6LuHOAFhE0elzddahd57f YPhx/D1MzW9X3pIvSo2eNn89hkRd0QLAO4D7NUdUXqWev1xLo8gmNI2XtgdXD4nC43RM OtDA== MIME-Version: 1.0 X-Received: by 10.229.0.141 with SMTP id 13mr4063703qcb.80.1366756496947; Tue, 23 Apr 2013 15:34:56 -0700 (PDT) In-Reply-To: <665fa76f-3a19-414b-8524-c2a5bfa8b21b@googlegroups.com> References: <9d0d46e5-b579-4edc-be34-0aa8798b66f8@googlegroups.com> <665fa76f-3a19-414b-8524-c2a5bfa8b21b@googlegroups.com> Date: Tue, 23 Apr 2013 15:34:56 -0700 Subject: Re: Reading a CSV file From: Dan Stromberg To: =?ISO-8859-1?Q?Ana_Dion=EDsio?= Content-Type: multipart/alternative; boundary=90e6ba308f827ecae104db0ecb69 Cc: python-list@python.org 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: 55 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1366756987 news.xs4all.nl 2298 [2001:888:2000:d::a6]:41705 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:44231 --90e6ba308f827ecae104db0ecb69 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Tue, Apr 23, 2013 at 2:58 PM, Ana Dion=EDsio w= rote: > Thank you, but can you explain it a little better? I am just starting in > python and I don't think I understood how to apply your awnser > -- > http://mail.python.org/mailman/listinfo/python-list > #!/usr/local/pypy-1.9/bin/pypy import csv def main(): with open('test.csv', 'r') as file_: for row in csv.reader(file_, delimiter=3D"|"): print row main() # Example input: # abc|def|ghi # jkl|mno|pqr In this way, you get one row at a time, instead of all rows at once. HTH --90e6ba308f827ecae104db0ecb69 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

On Tue, Apr 23, 2013 at 2:58 PM, Ana Dio= n=EDsio <anadionisio257@gmail.com> wrote:
Thank you, but can you explain it a little better? I am just starting in py= thon and I don't think I understood how to apply your awnser
--
http://mail.python.org/mailman/listinfo/python-list

#!/usr/local/pypy-1.9/bin/pypy

= import csv

def main():
=A0=A0=A0 with open('test.csv', &#= 39;r') as file_:
=A0=A0=A0=A0=A0=A0=A0 for row in csv.reader(file_, = delimiter=3D"|"):
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 print row

main()

# Example = input:
# abc|def|ghi
# jkl|mno|pqr

In this way, you get one ro= w at a time, instead of all rows at once.

HTH

--90e6ba308f827ecae104db0ecb69--