RE: [Zope] Appending to a file in Python
Oh, I had seen the append function being used in some examples through my google search. So I assumed that append was a built-in function. Thanks, I'll try write() -Laura -----Original Message----- From: zope-bounces@zope.org [mailto:zope-bounces@zope.org] On Behalf Of Paul Winkler Sent: Thursday, May 20, 2004 11:51 AM To: zope@zope.org Subject: Re: [Zope] Appending to a file in Python On Thu, May 20, 2004 at 11:36:36AM -0500, Laura McCord wrote:
I have been getting an error : 'file' object has no attribute 'append'
That's because python file objects really do not have an append method :-) Try the write method instead. It's good to get familiar with the Python docs, particularly the standard library reference: http://docs.python.org/lib/lib.html In this case, under "built-in types", you will find this: http://docs.python.org/lib/bltin-file-objects.html -- Paul Winkler http://www.slinkp.com _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Laura McCord wrote:
Oh, I had seen the append function being used in some examples through my google search. So I assumed that append was a built-in function.
It's a class method of sequences. Chris PS: The python lists are likely to be a better source of help for these types of problems. -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
participants (2)
-
Chris Withers -
Laura McCord