printing to files in python

Matthew Wilson mwilson at sarcastic-horse.com
Tue Sep 30 14:18:44 EDT 2003


Hi-

I want to print stuff like:

>>> "d1: %s, probability: %0.2f" % (d1, prob)

to a file, but when I do:

>>> str = "d1: %s, probability: %0.2f" % (d1, prob)
>>> outfile = open("out.txt", "w")
>>> outfile.write(str)

I get errors.  What am I missing?







More information about the Python-list mailing list