Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!rt.uk.eu.org!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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'memory.': 0.07; 'subject:Number': 0.09; 'subject:module': 0.09; 'subject:using': 0.09; 'cc:addr:python-list': 0.11; 'csv': 0.16; 'from:addr:pobox.com': 0.16; 'from:addr:skip': 0.16; 'subject:CSV': 0.16; 'sender:addr:gmail.com': 0.17; 'cc:addr:python.org': 0.22; 'skip': 0.24; '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; 'work.': 0.31; 'gives': 0.31; 'loading': 0.31; 'wind': 0.31; 'file': 0.32; 'received:google.com': 0.35; 'should': 0.36; 'error.': 0.37; 'entire': 0.61; "you'll": 0.62; 'to:addr:gmail.com': 0.65 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=93qoeUilfhzBXKikMrxpOhIsMuVZwNL0Uy4RhoZjX8U=; b=QXTysKiwzyF5qiKpYIaos2jKdpxiVJFnnVC49kvbFtgAOxebYNFJeBJ9Ra0YAdGASX PEJtMBUonzPoyd+lF0CbIfp/BiJ8f7s6S712V5COIz9b01qT+5HOVzliAOAqlY49/k50 HJpK2fYVkMHhGKzCOmIahBltnv80KrLk14Q1sfFcMTnST+rq46df4NZK+CBrmti/U38r Nf8PlFXFAyH1AN3AbWEOs/gGnvTUPMiytucCl2x3txvNoRpbz3rAfRbeSd2zP3ZWZ52P NbbkeD0Ss5cynrwl9OAJdWVRbKsqoIGVbjDMaJiuqQS6RL+Iy4TOZ+Fd4E9zeEaOdYDb dWvw== MIME-Version: 1.0 X-Received: by 10.50.176.166 with SMTP id cj6mr10632970igc.56.1368731269427; Thu, 16 May 2013 12:07:49 -0700 (PDT) Sender: skip.montanaro@gmail.com In-Reply-To: <8662be9c-e50c-48e9-86dc-1838c6188d0c@googlegroups.com> References: <5f4aec0e-5cfa-445f-af50-67cca7caae36@googlegroups.com> <8662be9c-e50c-48e9-86dc-1838c6188d0c@googlegroups.com> Date: Thu, 16 May 2013 14:07:49 -0500 X-Google-Sender-Auth: O_ArLQLnyq0cmyjtUSHc-xkkf0c Subject: Re: Number of cells, using CSV module From: Skip Montanaro To: tunacubes@gmail.com Content-Type: text/plain; charset=UTF-8 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: 11 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1368731278 news.xs4all.nl 15882 [2001:888:2000:d::a6]:52572 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45450 > len(reader) gives me an error. Apologies. len(list(reader)) should work. Of course, you'll wind up loading the entire CSV file into memory. You might want to just count row-by-row: n = 0 for row in reader: n += 1 Skip