[Zope] Re: Parsing a file through a Python script

Bories v. dem Bussche clamor at fafalter.de
Sun Nov 30 10:01:22 EST 2003


Pierre Godefroy wrote:
> I am trying to parse a file with a Python script (the file is stored in 
> the same folder as the script) :
> "marco" is the id of the file :
> 
> data=str(container.marco)
> i=0
> for line in data.readlines():
> .....
> 
You might want to try something like

from StringIO import StringIO
data = StringIO(str(getattr(container,'marco').data))


Bories

-- 
Bories v. dem Bussche
Duesseldorf - Germany





More information about the Zope mailing list