<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body>
Hi,<br>
<br>
Avoid using 'str' as your variable name. That's one of Python's
keywords and you should not use it.<br>
I believe that's what causing the problem.<br>
<br>
-shuhsien<br>
<br>
<blockquote type="cite"
cite="mid35005.199.169.240.132.1064945924.squirrel@svr1.turboweb.net">
<pre wrap="">Hi-
I want to print stuff like:
</pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">"d1: %s, probability: %0.2f" % (d1, prob)
</pre>
</blockquote>
</blockquote>
</blockquote>
<pre wrap=""><!---->
to a file, but when I do:
</pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">str = "d1: %s, probability: %0.2f" % (d1, prob)
outfile = open("out.txt", "w")
outfile.write(str)
</pre>
</blockquote>
</blockquote>
</blockquote>
<pre wrap=""><!---->
I get errors. What am I missing?
</pre>
</blockquote>
<br>
</body>
</html>