clear content of 'printed'

Christian Otteneuer chotty at freenet.de
Sun Aug 22 15:19:02 CEST 2004


Hello Newsgroup,

I have the following problem:
I want to write a python script, that writes text into files. The text is 
being "collected" in a for-loop, the code looks like this:

for i in range(len(myList)):
    id = myList[i]
    print "some text"
    container.writeToFile(id, printed)

Where writeToFile() creates a new file with the id 'id' and fills it with 
'printed'. The problem is, that I have to delete the
content of 'printed'  before entering the for-loop again. Else, I'll find 
the content of the past for-loops in my file. (The file created in the 
second loop would look like this:)

some text
some text

Is there a possibility to do clear the content of 'printed' in python?

Thanks alot!! 





More information about the Python-list mailing list