[Zope] Getting data from a file.

Dieter Maurer dieter@handshake.de
Wed, 2 Jan 2002 21:40:56 +0100


Ronald L. Chichester writes:
 > I have a text file loaded into Zope (2-4-3) as a File object.  I want to
 > "read" the file and do something with the information therein.  Ideally,
 > I would want to go through each line of data using a python script. 
 > However, the following doesn't work...
 > 
 > import string
 > 
 > lines = context.myFileObject.data
 > 
 > for line in lines:
 >   # do something
"File.data" is not a sequence of lines!

Use: "lines= string.split(str(context.myFileObject.data),'\n')".


Dieter