importing

eltronic at juno.com eltronic at juno.com
Sun Jan 4 00:53:54 CET 2004


On 3 Jan 2004 12:49:56 -0800 boomer4467 at yahoo.com (Boomer) writes:
> trying to import a .csv file(from excel) 
> into some fields on my company's
> software system(which interfaces to 
> an sql database. Each row in this
> .csv file needs to be split into smaller strings 
 
import csv 
 
#something to the efect of
 
data = file("book1.csv").readlines()
p = csv.parser()
 
for ir in data:
    fields = p.parse(ir)
    if not fields:
        # multi-line record
        continue
    print fields
    #you can take it further from here...
 
older than python 2.3 you have to 
download seperatly the csv module
pre compiled version are available.
http://www.object-craft.com.au/projects/csv
just had the opertunity to use it for
the first time yesterday, worked great!
 
e
please forward all spam  to "me"<u%63e at f%74c.go%76>

________________________________________________________________
The best thing to hit the internet in years - Juno SpeedBand!
Surf the web up to FIVE TIMES FASTER!
Only $14.95/ month - visit www.juno.com to sign up today!




More information about the Python-list mailing list