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


Groups > comp.lang.python > #45445

Number of cells, using CSV module

Newsgroups comp.lang.python
Date 2013-05-16 11:29 -0700
Message-ID <5f4aec0e-5cfa-445f-af50-67cca7caae36@googlegroups.com> (permalink)
Subject Number of cells, using CSV module
From tunacubes@gmail.com

Show all headers | 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