CSV DictReader loops when used with MySQLdb

2010-03-09 Thread Art Zemon
I'm going crazy. Using python 2.5.2 on 64 bit Linux. I have a class which reads CSV files using the CSV DictReader. If I print the rows, everything works perfectly. If I insert the rows into a MySQL table using MySQLdb, the DictReader loops back and begins re-reading from the beginning o

Re: using csv dictreader in python

2009-11-04 Thread Johann Spies
On Wed, Nov 04, 2009 at 01:25:16PM +0530, Siva Subramanian wrote: > This only gets me the following output > > {'FieldName1': '4', 'FieldName2': '0.00', 'FieldName3': > '4001433', 'FieldName4': '759'} > > 1. How do i access the 4, 0.00, ... the values ? >>> a= {'FieldName1': '4', 'FieldName2':

using csv dictreader in python

2009-11-04 Thread Siva Subramanian
Hello all, I am now trying to access the csv file using dictreader. import csv r25 = csv.DictReader(open('Report_ 25', 'rb'), delimiter=',') rownum = 1 for row in r25: # Save header row. if rownum == 0: header = row else: colnum = 0 for col in row: This onl

Re: csv dictreader

2008-03-20 Thread Dravidan
It looks like the backslash is messing the whole thing up so I reposted to try to find out how to get over the backslash hump. On Mar 20, 2:08 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Wed, 19 Mar 2008 11:06:40 -0700 (PDT), brnstrmrs > <[EMAIL PROTECTED]> declaimed the following in co

Re: csv dictreader

2008-03-19 Thread Mike Driscoll
On Mar 19, 1:55 pm, brnstrmrs <[EMAIL PROTECTED]> wrote: > On Mar 19, 2:32 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > > > > > On Mar 19, 1:06 pm, brnstrmrs <[EMAIL PROTECTED]> wrote: > > > > I am trying to use the dictionary reader to import the data from a csv > > > file and create a dictnary

Re: csv dictreader

2008-03-19 Thread brnstrmrs
On Mar 19, 2:32 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On Mar 19, 1:06 pm, brnstrmrs <[EMAIL PROTECTED]> wrote: > > > > > I am trying to use the dictionary reader to import the data from a csv > > file and create a dictnary from it but just can't seem to figure it > > out. > > > Here is my

Re: csv dictreader

2008-03-19 Thread Mike Driscoll
On Mar 19, 1:06 pm, brnstrmrs <[EMAIL PROTECTED]> wrote: > I am trying to use the dictionary reader to import the data from a csv > file and create a dictnary from it but just can't seem to figure it > out. > > Here is my code: > > >>>import csv > >>>reader = csv.DictReader(open('table.csv')) > >>>

csv dictreader

2008-03-19 Thread brnstrmrs
I am trying to use the dictionary reader to import the data from a csv file and create a dictnary from it but just can't seem to figure it out. Here is my code: >>>import csv >>>reader = csv.DictReader(open('table.csv')) >>>for row in reader: >>>print row my csv files looks like this: Bytecode,E