[Zope] readinf File contents

Michel Pelletier michel@digicool.com
Wed, 5 Jan 2000 13:29:28 -0500


> -----Original Message-----
> From: Chris McDonough 
> Sent: Wednesday, January 05, 2000 1:25 PM
> To: Michel Pelletier; 'Richard Smol'; zope@zope.org
> Subject: RE: [Zope] readinf File contents
> 
> 
> To get the contents of the file object, use its read() method, eg:
> 
> a=open("myfile.txt", "rb)
> output=a.read()
> 
> "output" is now a string you can use re on, etc.

As I understood Richard's question, he wanted to read the contents of a
Zope File Object, not a file on the filesystem, which is what your code
would work with.

In either case, Richard now knows how to do both.

-Michel

> 
> Chris McDonough     mailto:chrism@digicool.com
> Digital Creations   http://www.digicool.com
> Publishers of Zope  http://www.zope.org
> 
> > -----Original Message-----
> > From: Michel Pelletier [mailto:michel@digicool.com]
> > Sent: Wednesday, January 05, 2000 1:08 PM
> > To: 'Richard Smol'; zope@zope.org
> > Subject: RE: [Zope] readinf File contents
> > 
> > 
> > > -----Original Message-----
> > > From: Richard Smol [mailto:jazzcat@dds.nl]
> > > Sent: Wednesday, January 05, 2000 12:38 PM
> > > To: zope@zope.org
> > > Subject: [Zope] readinf File contents
> > > 
> > > 
> > > Hi there,
> > > 
> > > This Zope keeps baffling me ... now how do I simply read the 
> > > contents of 
> > > a File-object?
> > 
> > fileObject.data or str(fileObject)
> > 
> > Referencing a file object by name from python will not return it's
> > contents, it will return the object.  The object does not, 
> nor should
> > it, act or look like a string, which is what re.split expects.
> > 
> > -Michel
> > 
> > _______________________________________________
> > 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 )
> > 
>