printing to files in python
Tom Hanks
thanks200 at hotmail.com
Tue Sep 30 21:55:57 EDT 2003
"Matthew Wilson" <mwilson at sarcastic-horse.com> wrote in message news:<mailman.1064946050.8907.python-list at python.org>...
> >>> str = "d1: %s, probability: %0.2f" % (d1, prob)
> >>> outfile = open("out.txt", "w")
> >>> outfile.write(str)
>
> I get errors. What am I missing?
What are you missing? You are missing including your actual errors
in this question.
The only error I get when running your code (Python 2.3, Windows)
is "d1" and "prob" aren't defined. If I fix that then "out.txt" is
written as expected.
TTFN,
Tom.
More information about the Python-list
mailing list