clear content of 'printed'

Peter Otten __peter__ at web.de
Sun Aug 22 16:04:55 CEST 2004


Christian Otteneuer wrote:

> Is there a possibility to do clear the content of 'printed' in python?
 
What is 'printed'? A string, a list, a dictionary, a StringIO instance... -
as long as we do not know what it is we cannot say how/whether it can be
cleared. It is common practice in Python to just forget about an old object
and create a new one, though:

for path in aList:
    printed = Printed()
    printed.fillWith("some text")
    container.writeToFile(path, printed)

Or was the 

print "some text"

statement for real and you are assigning to sys.stdout (generally a bad
idea)?

Please provide the complete source code or at least some more context.

Peter




More information about the Python-list mailing list