<div>It works now.</div>
<div>&nbsp;</div>
<div>Closed everything down and reopened.</div>
<div>&nbsp;</div>
<div>Thanks.<br><br></div>
<div class="gmail_quote">On Dec 10, 2007 5:07 PM, Bryan Fodness &lt;<a href="mailto:bryan.fodness@gmail.com">bryan.fodness@gmail.com</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">I ran it both in IDLE and Command Prompt 
<div>
<div></div>
<div class="Wj3C7c"><br><br>
<div class="gmail_quote">On Dec 10, 2007 5:02 PM, Kent Johnson &lt;<a href="mailto:kent37@tds.net" target="_blank">kent37@tds.net</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>How are you running the program?<br><br></div>
<div>Bryan Fodness wrote:<br>&gt;<br>&gt; for line in file(&#39;test.txt&#39;):<br>&gt; &nbsp; &nbsp; the_line = line.split()<br>&gt; &nbsp; &nbsp; if the_line:<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; if the_line[0] == &#39;Index&#39;:<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; index = float(the_line[-1]) 
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print (&quot;\rIndex = %.3f &nbsp;&quot;) %index,<br>&gt; raw_input(&quot;\nExit&quot;)<br>&gt; Here is my output,<br>&gt;<br>&gt; Index = 0.000 &nbsp; Index = 0.400 &nbsp; Index = 0.800 &nbsp; Index = 1.000<br>&gt;<br>&gt; 
<br>&gt; On Dec 10, 2007 4:48 PM, Kent Johnson &lt;<a href="mailto:kent37@tds.net" target="_blank">kent37@tds.net</a><br></div>
<div>&gt; &lt;mailto:<a href="mailto:kent37@tds.net" target="_blank">kent37@tds.net</a>&gt;&gt; wrote:<br>&gt;<br>&gt; &nbsp; &nbsp; Bryan Fodness wrote:<br>&gt; &nbsp; &nbsp; &nbsp;&gt; Here is the code.<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; for line in file(&#39; 
test.txt&#39;):<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; the_line = line.split()<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; if the_line:<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp; &nbsp; if the_line[0] == &#39;Index&#39;:<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; index = float(the_line[-1])<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print (&quot;\rIndex = %.3f&quot;) %index 
<br>&gt;<br>&gt; &nbsp; &nbsp; Add a comma at the end of the above line to suppress the newline that<br>&gt; &nbsp; &nbsp; print normally outputs.<br>&gt;<br>&gt; &nbsp; &nbsp; Kent<br>&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; raw_input(&quot;\nExit&quot;)<br>&gt; &nbsp; &nbsp; &nbsp;&gt; 
<br>&gt; &nbsp; &nbsp; &nbsp;&gt; Here is the output.<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; Index = 0.000<br>&gt; &nbsp; &nbsp; &nbsp;&gt; Index = 0.400<br>&gt; &nbsp; &nbsp; &nbsp;&gt; Index = 0.800<br>&gt; &nbsp; &nbsp; &nbsp;&gt; Index = 1.000<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; Exit 
<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; On Dec 10, 2007 4:33 PM, Kent Johnson &lt;<a href="mailto:kent37@tds.net" target="_blank">kent37@tds.net</a><br>&gt; &nbsp; &nbsp; &lt;mailto:<a href="mailto:kent37@tds.net" target="_blank">
kent37@tds.net</a> &gt;<br></div>
<div>
<div></div>
<div>&gt; &nbsp; &nbsp; &nbsp;&gt; &lt;mailto:<a href="mailto:kent37@tds.net" target="_blank">kent37@tds.net</a> &lt;mailto:<a href="mailto:kent37@tds.net" target="_blank">kent37@tds.net</a>&gt;&gt;&gt; wrote:<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; Bryan Fodness wrote: 
<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; I do want to overwrite the same line.<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; I do not see a difference between using the \r and not<br>&gt; &nbsp; &nbsp; using it.<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>
&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; How are you running the program? Try it from a command line<br>&gt; &nbsp; &nbsp; if that is<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; not what you are doing. Can you show your new code?<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; Kent<br>
&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; PS Please Reply All to stay on the list.<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; On Dec 10, 2007 2:43 PM, Kent Johnson &lt;<a href="mailto:kent37@tds.net" target="_blank">
 kent37@tds.net</a><br>&gt; &nbsp; &nbsp; &lt;mailto:<a href="mailto:kent37@tds.net" target="_blank">kent37@tds.net</a>&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &lt;mailto:<a href="mailto:kent37@tds.net" target="_blank">kent37@tds.net</a> &lt;mailto:
<a href="mailto:kent37@tds.net" target="_blank"> kent37@tds.net</a>&gt;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &lt;mailto:<a href="mailto:kent37@tds.net" target="_blank">kent37@tds.net</a> &lt;mailto:<a href="mailto:kent37@tds.net" target="_blank">
kent37@tds.net</a>&gt;<br>&gt; &nbsp; &nbsp; &lt;mailto:<a href="mailto:kent37@tds.net" target="_blank"> kent37@tds.net</a> &lt;mailto:<a href="mailto:kent37@tds.net" target="_blank">kent37@tds.net</a>&gt;&gt;&gt;&gt; wrote:<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;
<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; Bryan Fodness wrote:<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; I have a print statement in a for loop so I can <br>&gt; &nbsp; &nbsp; watch the<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; progress<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;
<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; for line in file(file):<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; the_line = line.split()<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; if the_line:<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp; &nbsp; print (&quot;Index = %.2f&quot;) %index
<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; Is there a way that only one line will be output <br>&gt; &nbsp; &nbsp; and the<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; variable is<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; updated rather than one line for every index.
<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; I&#39;m not sure I understand what you are asking. index <br>&gt; &nbsp; &nbsp; is never<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; updated in<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; the loop above.
<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; If you want to overwrite the same line on the console, try <br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp; print &quot;\rIndex = %.2f&quot; % index,<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;
<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; note ----^<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;---------------------------^<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; <br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; You might need some extra spaces at the end of the
<br>&gt; &nbsp; &nbsp; print to<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &#39;erase&#39; a<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; longer previous line.<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; <br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; Kent<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;
<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; --<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &quot;The game of science can accurately be described as a <br>&gt; &nbsp; &nbsp; never-ending<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; insult to human intelligence.&quot; - Joćo Magueijo
<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; --<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &quot;The game of science can accurately be described as a never-ending <br>&gt; &nbsp; &nbsp; &nbsp;&gt; insult to human intelligence.&quot; - Joćo Magueijo
<br>&gt;<br>&gt;<br>&gt;<br>&gt;<br>&gt; --<br>&gt; &quot;The game of science can accurately be described as a never-ending<br>&gt; insult to human intelligence.&quot; - Joćo Magueijo <br><br></div></div></blockquote></div>
<br><br clear="all"><br></div></div>-- 
<div>
<div></div>
<div class="Wj3C7c"><br>&quot;The game of science can accurately be described as a never-ending insult to human intelligence.&quot; - Joćo Magueijo </div></div></blockquote></div><br><br clear="all"><br>-- <br>"The game of science can accurately be described as a never-ending insult to human intelligence." - Joćo Magueijo