On 2014-12-29 16:37, JC wrote:
> On Mon, 29 Dec 2014 10:32:03 -0600, Skip Montanaro wrote:
>
> > On Mon, Dec 29, 2014 at 10:11 AM, JC
> > wrote:
> >> Do I have to open the file again to get 'rdr' work again?
> >
> > Yes, but if you want the number of records, just operate on the
> > rows list, e
On 2014-12-29 16:11, JC wrote:
> On Mon, 29 Dec 2014 09:47:23 -0600, Skip Montanaro wrote:
>
> > On Mon, Dec 29, 2014 at 9:35 AM, JC wrote:
> >> How could I get the all the records?
> >
> > This should work:
> >
> > with open('x.csv','rb') as f:
> > rdr = csv.DictReader(f,delimiter=',')
> >
On Mon, 29 Dec 2014 10:32:03 -0600, Skip Montanaro wrote:
> On Mon, Dec 29, 2014 at 10:11 AM, JC wrote:
>> Do I have to open the file again to get 'rdr' work again?
>
> Yes, but if you want the number of records, just operate on the rows
> list, e.g. len(rows).
>
> Skip
Yes, I did that. But if
On Mon, Dec 29, 2014 at 10:11 AM, JC wrote:
> Do I have to open the file again to get 'rdr' work again?
Yes, but if you want the number of records, just operate on the rows
list, e.g. len(rows).
Skip
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, 29 Dec 2014 09:47:23 -0600, Skip Montanaro wrote:
> On Mon, Dec 29, 2014 at 9:35 AM, JC wrote:
>> How could I get the all the records?
>
> This should work:
>
> with open('x.csv','rb') as f:
> rdr = csv.DictReader(f,delimiter=',')
> rows = list(rdr)
>
> You will be left with a
On Mon, Dec 29, 2014 at 9:35 AM, JC wrote:
> How could I get the all the records?
This should work:
with open('x.csv','rb') as f:
rdr = csv.DictReader(f,delimiter=',')
rows = list(rdr)
You will be left with a list of dictionaries, one dict per row, keyed
by the values in the first row: