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


Groups > comp.lang.python > #45450

Re: Number of cells, using CSV module

References <5f4aec0e-5cfa-445f-af50-67cca7caae36@googlegroups.com> <mailman.1769.1368729617.3114.python-list@python.org> <8662be9c-e50c-48e9-86dc-1838c6188d0c@googlegroups.com>
Date 2013-05-16 14:07 -0500
Subject Re: Number of cells, using CSV module
From Skip Montanaro <skip@pobox.com>
Newsgroups comp.lang.python
Message-ID <mailman.1770.1368731278.3114.python-list@python.org> (permalink)

Show all headers | View raw


> 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

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


Thread

Number of cells, using CSV module tunacubes@gmail.com - 2013-05-16 11:29 -0700
  Re: Number of cells, using CSV module Skip Montanaro <skip@pobox.com> - 2013-05-16 13:40 -0500
    Re: Number of cells, using CSV module tunacubes@gmail.com - 2013-05-16 11:50 -0700
      Re: Number of cells, using CSV module Skip Montanaro <skip@pobox.com> - 2013-05-16 14:07 -0500
      Re: Number of cells, using CSV module Tim Chase <python.list@tim.thechases.com> - 2013-05-16 15:00 -0500
  Re: Number of cells, using CSV module tunacubes@gmail.com - 2013-05-16 11:53 -0700
    Re: Number of cells, using CSV module Skip Montanaro <skip@pobox.com> - 2013-05-16 14:08 -0500
    Re: Number of cells, using CSV module Tim Chase <python.list@tim.thechases.com> - 2013-05-16 15:01 -0500
  Re: Number of cells, using CSV module tunacubes@gmail.com - 2013-05-16 13:11 -0700

csiph-web