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


Groups > comp.lang.python > #45445

Number of cells, using CSV module

X-Received by 10.224.200.202 with SMTP id ex10mr26343065qab.8.1368728966065; Thu, 16 May 2013 11:29:26 -0700 (PDT)
X-Received by 10.49.95.137 with SMTP id dk9mr3318535qeb.34.1368728966009; Thu, 16 May 2013 11:29:26 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!gj8no601870qab.0!news-out.google.com!y6ni49017qax.0!nntp.google.com!gj8no601861qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Thu, 16 May 2013 11:29:25 -0700 (PDT)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=199.101.104.254; posting-account=e9hX2gkAAAC_HUpjgT5rz6JHTkyYbrbO
NNTP-Posting-Host 199.101.104.254
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <5f4aec0e-5cfa-445f-af50-67cca7caae36@googlegroups.com> (permalink)
Subject Number of cells, using CSV module
From tunacubes@gmail.com
Injection-Date Thu, 16 May 2013 18:29:26 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.python:45445

Show key headers only | View raw


I'm using the csv module to get information from a csv file. I have items listed in Column A. I want to know how many items are listed in Column A. 

import csv
with open('test.csv', 'r') as f:
    reader = csv.reader(f)
    for column in reader:
        column = (column[0])
        print(column)     

We are given

>a
>b
>c
>d
>e
>f

How would I go about getting the amount of numbers that are printed? If I try printing len(column), I get 
>1
>1
>1
>1
>1
>1

Back to comp.lang.python | Previous | NextNext 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