[Zope] Importing Data

Farrell, Troy troy.farrell@wcg.com
Thu, 9 Aug 2001 10:12:16 -0500


This is fairly straight forward in python:

import string

f = open('file.csv')
for a in f.readlines():
  b = string.split(a, ',')
  # b is a list of all the line elements

All you need to do after that is use the data in b to add a ZClass instance.

Troy

> -----Original Message-----
> From: Dean Jones [mailto:djones@sputnik7.com]
> Sent: Wednesday, August 08, 2001 3:27 PM
> To: Farrell, Troy
> Subject: RE: [Zope] Importing Data
> 
> 
> this is exactly what I am trying to figure out right now. 
> Have you seen an
> example of this type of external method anywhere?
> 
> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
> Farrell, Troy
> Sent: Wednesday, August 08, 2001 4:13 PM
> To: 'Chris Bruce'; zope@zope.org
> Subject: RE: [Zope] Importing Data
> 
> 
> It may just be me, but your question doesn't make sense.  I 
> think you want
> to:
> 
> 1) Make a zclass that holds the data
> 2) Write an external method that parses the csv file and
> 3) use the same external method to add instances of the 
> ZClass with the data
> from the csv file.
> 
> Troy
> 
> > -----Original Message-----
> > From: Chris Bruce [mailto:chrisabruce@yahoo.com]
> > Sent: Tuesday, August 07, 2001 11:44 AM
> > To: zope@zope.org
> > Subject: [Zope] Importing Data
> >
> >
> > I have a csv file and I would like to import it into a zclass
> > structure.  Is there a way to do this in Zope?
> >
> >
> > Thanks,
> >
> > Chris
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Make international calls for as low as $.04/minute with
> > Yahoo! Messenger
> > http://phonecard.yahoo.com/
> >
> > _______________________________________________
> > Zope maillist  -  Zope@zope.org
> > http://lists.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists -
> >  http://lists.zope.org/mailman/listinfo/zope-announce
> >  http://lists.zope.org/mailman/listinfo/zope-dev )
> >
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>