[Tutor] A style question

Nicole Seitz nicole.seitz@urz.uni-hd.de
Wed, 17 Apr 2002 20:24:38 +0200


Hi there!

I wrote these lines to write some stuff to a file.
Is there a way to reduce the number of lines needed here?There are so many 
uses of 'output.write'.

output.write("Number of lines: %s\n" % str(linecount))
    output.write("Total word count: %s\n" % str(wordcount))
    output.write("Total character count: %s\n\n"% str(charcount))
    for word in keyList:
        output.write("word: ")
        output.write(word)
        output.write(",    occurences:")
        output.write((str(occurences[word])))
        output.write("\n")

Thanks for your help!


Nicole