On Aug 28, 7:51 am, norseman <[EMAIL PROTECTED]> wrote:
> Peter Otten wrote:
> > John S wrote:
>
> >> [OP] Jon Clements wrote:
> >>> On Aug 27, 12:54 pm, SimonPalmer <[EMAIL PROTECTED]> wrote:
> after reading the file throughthe csv.reader for the length I cannot
> iterate over the rows.
Peter Otten wrote:
John S wrote:
[OP] Jon Clements wrote:
On Aug 27, 12:54 pm, SimonPalmer <[EMAIL PROTECTED]> wrote:
after reading the file throughthe csv.reader for the length I cannot
iterate over the rows. How do I reset the row iterator?
A CSV file is just a text file. Don't use csv.re
John S wrote:
after reading the file throughthe csv.reader for the length I cannot
iterate over the rows. How do I reset the row iterator?
A CSV file is just a text file. Don't use csv.reader for counting rows
-- it's overkill. You can just read the file normally, counting lines
(lines == row
John S wrote:
> [OP] Jon Clements wrote:
>> On Aug 27, 12:54 pm, SimonPalmer <[EMAIL PROTECTED]> wrote:
>>> after reading the file throughthe csv.reader for the length I cannot
>>> iterate over the rows. How do I reset the row iterator?
>
> A CSV file is just a text file. Don't use csv.reader fo
[OP] Jon Clements wrote:
> On Aug 27, 12:54 pm, SimonPalmer <[EMAIL PROTECTED]> wrote:
>> after reading the file throughthe csv.reader for the length I cannot
>> iterate over the rows. How do I reset the row iterator?
A CSV file is just a text file. Don't use csv.reader for counting rows
-- it's
Jon Clements wrote:
> On Aug 27, 12:54 pm, SimonPalmer <[EMAIL PROTECTED]> wrote:
>> after reading the file throughthe csv.reader for the length I cannot
>> iterate over the rows. How do I reset the row iterator?
>
> If you're sure that the number of rows is always less than 200.
Or 2000. Or 2
Use csv.DictReader to get a list of dicts (you get one for each row,
with the values as the vals and the column headings as the keys) and
then do a len(list)?
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 27, 1:15 pm, John Machin <[EMAIL PROTECTED]> wrote:
> On Aug 27, 9:54 pm, SimonPalmer <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Aug 27, 12:50 pm, SimonPalmer <[EMAIL PROTECTED]> wrote:
>
> > > On Aug 27, 12:41 pm, Jon Clements <[EMAIL PROTECTED]> wrote:
>
> > > > On Aug 27, 12:29 pm, "Simon Br
On Aug 27, 9:54 pm, SimonPalmer <[EMAIL PROTECTED]> wrote:
> On Aug 27, 12:50 pm, SimonPalmer <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Aug 27, 12:41 pm, Jon Clements <[EMAIL PROTECTED]> wrote:
>
> > > On Aug 27, 12:29 pm, "Simon Brunning" <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > 2008/8/27 SimonPal
On Aug 27, 12:54 pm, SimonPalmer <[EMAIL PROTECTED]> wrote:
> On Aug 27, 12:50 pm, SimonPalmer <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Aug 27, 12:41 pm, Jon Clements <[EMAIL PROTECTED]> wrote:
>
> > > On Aug 27, 12:29 pm, "Simon Brunning" <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > 2008/8/27 SimonPa
On Aug 27, 12:48 pm, "Simon Brunning" <[EMAIL PROTECTED]>
wrote:
> 2008/8/27 Jon Clements <[EMAIL PROTECTED]>:
>
> >> len(list(csv.reader(open('my.csv'
> > Not the best of ideas if the row size or number of rows is large!
> > Manufacture a list, then discard to get its length -- ouch!
>
> I do
On Aug 27, 12:50 pm, SimonPalmer <[EMAIL PROTECTED]> wrote:
> On Aug 27, 12:41 pm, Jon Clements <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Aug 27, 12:29 pm, "Simon Brunning" <[EMAIL PROTECTED]>
> > wrote:
>
> > > 2008/8/27 SimonPalmer <[EMAIL PROTECTED]>:
>
> > > > anyone know how I would find out how
On Aug 27, 12:41 pm, Jon Clements <[EMAIL PROTECTED]> wrote:
> On Aug 27, 12:29 pm, "Simon Brunning" <[EMAIL PROTECTED]>
> wrote:
>
> > 2008/8/27 SimonPalmer <[EMAIL PROTECTED]>:
>
> > > anyone know how I would find out how many rows are in a csv file?
>
> > > I can't find a method which does this
2008/8/27 Jon Clements <[EMAIL PROTECTED]>:
>> len(list(csv.reader(open('my.csv'
> Not the best of ideas if the row size or number of rows is large!
> Manufacture a list, then discard to get its length -- ouch!
I do try to avoid premature optimization. ;-)
--
Cheers,
Simon B.
--
http://mai
On Aug 27, 12:29 pm, "Simon Brunning" <[EMAIL PROTECTED]>
wrote:
> 2008/8/27 SimonPalmer <[EMAIL PROTECTED]>:
>
> > anyone know how I would find out how many rows are in a csv file?
>
> > I can't find a method which does this on csv.reader.
>
> len(list(csv.reader(open('my.csv'
>
> --
> Cheers,
On Aug 27, 12:16 pm, SimonPalmer <[EMAIL PROTECTED]> wrote:
> anyone know how I would find out how many rows are in a csv file?
>
> I can't find a method which does this on csv.reader.
>
> Thanks in advance
You have to iterate each row and count them -- there's no other way
without supporting info
2008/8/27 SimonPalmer <[EMAIL PROTECTED]>:
> anyone know how I would find out how many rows are in a csv file?
>
> I can't find a method which does this on csv.reader.
len(list(csv.reader(open('my.csv'
--
Cheers,
Simon B.
[EMAIL PROTECTED]
http://www.brunningonline.net/simon/blog/
--
http://
anyone know how I would find out how many rows are in a csv file?
I can't find a method which does this on csv.reader.
Thanks in advance
--
http://mail.python.org/mailman/listinfo/python-list
18 matches
Mail list logo