<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-36506138.post3590371759556102549..comments</id><updated>2009-04-08T23:57:54.780-04:00</updated><title type='text'>Comments on Chad W. L. Whitacre: A use for the carriage return</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blag.whit537.org/feeds/3590371759556102549/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default'/><link rel='alternate' type='text/html' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html'/><author><name>whit537</name><uri>http://www.blogger.com/profile/05060120882054416919</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>13</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-36506138.post-1683058953122251326</id><published>2009-04-08T23:57:00.000-04:00</published><updated>2009-04-08T23:57:00.000-04:00</updated><title type='text'>I discovered this when I was developing my first b...</title><content type='html'>I discovered this when I was developing my first bootloader. Whenever I printed text and ended it with a newline, it would skip to the next line at the same column:&lt;BR/&gt;&lt;BR/&gt;Welcome to the YakOS bootloader!&lt;BR/&gt;                                Now loading stage 2....&lt;BR/&gt;&lt;BR/&gt;I think having \r\n as the EOL indicator was an easy way to print a file correctly to stdout.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/1683058953122251326'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/1683058953122251326'/><link rel='alternate' type='text/html' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html?showComment=1239249420000#c1683058953122251326' title=''/><author><name>theY4Kman</name><uri>http://www.blogger.com/profile/14545378208903237278</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html' ref='tag:blogger.com,1999:blog-36506138.post-3590371759556102549' source='http://www.blogger.com/feeds/36506138/posts/default/3590371759556102549' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-36506138.post-1001452184471975255</id><published>2009-01-08T09:51:00.000-05:00</published><updated>2009-01-08T09:51:00.000-05:00</updated><title type='text'>I was trying to figure out how to make a countdown...</title><content type='html'>I was trying to figure out how to make a countdown clock, and this totally helped me out.  Thanks!&lt;BR/&gt;&lt;BR/&gt;import sys&lt;BR/&gt;import time&lt;BR/&gt;&lt;BR/&gt;flush = sys.stdout.flush&lt;BR/&gt;sleep = time.sleep&lt;BR/&gt;&lt;BR/&gt;print &amp;#39;How much time do you want on the clock?&amp;#39;,&lt;BR/&gt;answer = raw_input()&lt;BR/&gt;answer = answer.split(&amp;#39;:&amp;#39;)&lt;BR/&gt;&lt;BR/&gt;hrs = int(answer[0])&lt;BR/&gt;mns = int(answer[1])&lt;BR/&gt;sec = int(answer[2])&lt;BR/&gt;&lt;BR/&gt;pause = 1&lt;BR/&gt;&lt;BR/&gt;while sec &amp;gt;= 0:&lt;BR/&gt;    print &amp;#39;\r%02i:%02i:%02i&amp;#39; % (hrs, mns, sec),&lt;BR/&gt;    flush()&lt;BR/&gt;    sleep(pause)&lt;BR/&gt;    sec -= 1&lt;BR/&gt;    if sec == 0:&lt;BR/&gt;        if mns &amp;gt; 0:&lt;BR/&gt;            mns -= 1&lt;BR/&gt;            sec += 59&lt;BR/&gt;        elif mns == 0 and hrs &amp;gt; 0:&lt;BR/&gt;            hrs -= 1&lt;BR/&gt;            mns += 59&lt;BR/&gt;            sec += 59</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/1001452184471975255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/1001452184471975255'/><link rel='alternate' type='text/html' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html?showComment=1231426260000#c1001452184471975255' title=''/><author><name>Ryan</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html' ref='tag:blogger.com,1999:blog-36506138.post-3590371759556102549' source='http://www.blogger.com/feeds/36506138/posts/default/3590371759556102549' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-36506138.post-5548513838812765419</id><published>2008-11-25T18:56:00.000-05:00</published><updated>2008-11-25T18:56:00.000-05:00</updated><title type='text'>Oooh, neat! And extra points for 3.0 syntax, Anony...</title><content type='html'>Oooh, neat! And extra points for &lt;A HREF="http://docs.python.org/dev/3.0/library/functions.html#print" REL="nofollow"&gt;3.0 syntax&lt;/A&gt;, Anonymous. ;^)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/5548513838812765419'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/5548513838812765419'/><link rel='alternate' type='text/html' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html?showComment=1227657360000#c5548513838812765419' title=''/><author><name>whit537</name><uri>http://blag.whit537.org/</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html' ref='tag:blogger.com,1999:blog-36506138.post-3590371759556102549' source='http://www.blogger.com/feeds/36506138/posts/default/3590371759556102549' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-36506138.post-476782304051298323</id><published>2008-11-25T18:24:00.000-05:00</published><updated>2008-11-25T18:24:00.000-05:00</updated><title type='text'>Try:print('\rvery long status', end='')print('\rsh...</title><content type='html'>Try:&lt;BR/&gt;&lt;BR/&gt;print('\rvery long status', end='')&lt;BR/&gt;print('\rshort status', end='')&lt;BR/&gt;&lt;BR/&gt;To solve this use:&lt;BR/&gt;&lt;BR/&gt;print('\rvery long status', end='')&lt;BR/&gt;print('\r\x1b[K\rshort status', end='')&lt;BR/&gt;&lt;BR/&gt;More at: http://www.termsys.demon.co.uk/vtansi.htm</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/476782304051298323'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/476782304051298323'/><link rel='alternate' type='text/html' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html?showComment=1227655440000#c476782304051298323' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html' ref='tag:blogger.com,1999:blog-36506138.post-3590371759556102549' source='http://www.blogger.com/feeds/36506138/posts/default/3590371759556102549' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-36506138.post-8617082928577460494</id><published>2008-11-25T01:49:00.000-05:00</published><updated>2008-11-25T01:49:00.000-05:00</updated><title type='text'>Every once in a while, along comes a post that rem...</title><content type='html'>Every once in a while, along comes a post that reminds me of just how much baggage I still have sloshing around in my head.&lt;BR/&gt;&lt;BR/&gt;Here is a &amp;#39;spinner&amp;#39;&lt;BR/&gt;&lt;BR/&gt;bash$ python -c &amp;#39;&lt;BR/&gt;&amp;gt; import time,sys&lt;BR/&gt;&amp;gt; while True:&lt;BR/&gt;&amp;gt; ..for char in r&amp;quot;/-\|&amp;quot;:&lt;BR/&gt;&amp;gt; ....sys.stdout.write(&amp;quot;\r&amp;quot; + char)&lt;BR/&gt;&amp;gt; ....sys.stdout.flush()&lt;BR/&gt;&amp;gt; ....time.sleep(0.1)&lt;BR/&gt;&amp;gt; &amp;#39;&lt;BR/&gt;&lt;BR/&gt;(dots for indentation)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/8617082928577460494'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/8617082928577460494'/><link rel='alternate' type='text/html' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html?showComment=1227595740000#c8617082928577460494' title=''/><author><name>Paddy3118</name><uri>http://www.blogger.com/profile/06899509753521482267</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html' ref='tag:blogger.com,1999:blog-36506138.post-3590371759556102549' source='http://www.blogger.com/feeds/36506138/posts/default/3590371759556102549' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-36506138.post-5612867409620540424</id><published>2008-11-25T00:46:00.000-05:00</published><updated>2008-11-25T00:46:00.000-05:00</updated><title type='text'>Here's an animated example showing write and flush...</title><content type='html'>Here&amp;#39;s an animated example showing write and flush.&lt;BR/&gt;&lt;BR/&gt;import sys&lt;BR/&gt;import time&lt;BR/&gt;&lt;BR/&gt;sleep = time.sleep&lt;BR/&gt;write = sys.stdout.write&lt;BR/&gt;flush = sys.stdout.flush&lt;BR/&gt;&lt;BR/&gt;message = &amp;#39;PYTHON&amp;#39;&lt;BR/&gt;for i, c in enumerate(message):&lt;BR/&gt;    write(&amp;#39;_&amp;#39; * i + c)&lt;BR/&gt;    flush()&lt;BR/&gt;    sleep(.5)&lt;BR/&gt;    write(&amp;#39;\r&amp;#39;)&lt;BR/&gt;&lt;BR/&gt;write(message)&lt;BR/&gt;flush()&lt;BR/&gt;sleep(.5)&lt;BR/&gt;write(&amp;#39;!&amp;#39;)&lt;BR/&gt;flush()&lt;BR/&gt;sleep(.5)&lt;BR/&gt;&lt;BR/&gt;While &amp;#39;\r&amp;#39; returns to the beginning of the line, it doesn&amp;#39;t clear what&amp;#39;s already on the line so you may need to pad your text with trailing spaces to cover the previous text.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/5612867409620540424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/5612867409620540424'/><link rel='alternate' type='text/html' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html?showComment=1227591960000#c5612867409620540424' title=''/><author><name>David Niergarth</name><uri>http://www.blogger.com/profile/01634052299681863462</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html' ref='tag:blogger.com,1999:blog-36506138.post-3590371759556102549' source='http://www.blogger.com/feeds/36506138/posts/default/3590371759556102549' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-36506138.post-477205016649800167</id><published>2008-11-24T18:57:00.000-05:00</published><updated>2008-11-24T18:57:00.000-05:00</updated><title type='text'>Gabriel: what she said.However I'm not seeing the ...</title><content type='html'>Gabriel: what she said.&lt;BR/&gt;&lt;BR/&gt;However I&amp;#39;m not seeing the comma suppress the newline:&lt;BR/&gt;&lt;BR/&gt;&amp;gt;&amp;gt;&amp;gt; print &amp;#39;foo&amp;#39;,&lt;BR/&gt;foo&lt;BR/&gt;&amp;gt;&amp;gt;&amp;gt; import sys&lt;BR/&gt;&amp;gt;&amp;gt;&amp;gt; sys.stdout.write(&amp;#39;foo&amp;#39;)&lt;BR/&gt;foo&amp;gt;&amp;gt;&amp;gt;&lt;BR/&gt;&lt;BR/&gt;That&amp;#39;d be a neat trick if it worked.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/477205016649800167'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/477205016649800167'/><link rel='alternate' type='text/html' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html?showComment=1227571020000#c477205016649800167' title=''/><author><name>whit537</name><uri>http://blag.whit537.org/</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html' ref='tag:blogger.com,1999:blog-36506138.post-3590371759556102549' source='http://www.blogger.com/feeds/36506138/posts/default/3590371759556102549' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-36506138.post-463642100870465127</id><published>2008-11-24T17:36:00.000-05:00</published><updated>2008-11-24T17:36:00.000-05:00</updated><title type='text'>@Anonymous: Thanks a lot :)sooooooooo nice this wa...</title><content type='html'>@Anonymous: Thanks a lot :)&lt;BR/&gt;sooooooooo nice this way :D</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/463642100870465127'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/463642100870465127'/><link rel='alternate' type='text/html' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html?showComment=1227566160000#c463642100870465127' title=''/><author><name>Gabriel</name><uri>http://www.blogger.com/profile/15201248057871786129</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html' ref='tag:blogger.com,1999:blog-36506138.post-3590371759556102549' source='http://www.blogger.com/feeds/36506138/posts/default/3590371759556102549' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-36506138.post-8374895725050364669</id><published>2008-11-24T17:24:00.000-05:00</published><updated>2008-11-24T17:24:00.000-05:00</updated><title type='text'>@Gabrielprint is putting a '\n' at the end.you can...</title><content type='html'>@Gabriel&lt;BR/&gt;print is putting a '\n' at the end.&lt;BR/&gt;&lt;BR/&gt;you can either use&lt;BR/&gt;&lt;BR/&gt;print '\r'+str(i),&lt;BR/&gt;# the comma prevent the newline&lt;BR/&gt;&lt;BR/&gt;or &lt;BR/&gt;sys.stdout.write('\r'+str(i))&lt;BR/&gt;&lt;BR/&gt;in either case you need to call&lt;BR/&gt;sys.stdout.flush() to flush the lines when there isn't a newline at the end.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/8374895725050364669'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/8374895725050364669'/><link rel='alternate' type='text/html' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html?showComment=1227565440000#c8374895725050364669' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html' ref='tag:blogger.com,1999:blog-36506138.post-3590371759556102549' source='http://www.blogger.com/feeds/36506138/posts/default/3590371759556102549' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-36506138.post-740565683568543735</id><published>2008-11-24T17:05:00.000-05:00</published><updated>2008-11-24T17:05:00.000-05:00</updated><title type='text'>#!/usr/bin/env pythonimport timefor i in range(100...</title><content type='html'>#!/usr/bin/env python&lt;BR/&gt;import time&lt;BR/&gt;&lt;BR/&gt;for i in range(100):&lt;BR/&gt;____time.sleep(.01)&lt;BR/&gt;____print &amp;#39;\r&amp;#39;+i*&amp;#39;=&amp;#39;+&amp;#39;&amp;gt;&amp;#39;&lt;BR/&gt;&lt;BR/&gt;indentation with &amp;#39;_&amp;#39; sorry.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/740565683568543735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/740565683568543735'/><link rel='alternate' type='text/html' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html?showComment=1227564300000#c740565683568543735' title=''/><author><name>Gabriel</name><uri>http://www.blogger.com/profile/15201248057871786129</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html' ref='tag:blogger.com,1999:blog-36506138.post-3590371759556102549' source='http://www.blogger.com/feeds/36506138/posts/default/3590371759556102549' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-36506138.post-8855076159870801638</id><published>2008-11-24T17:04:00.000-05:00</published><updated>2008-11-24T17:04:00.000-05:00</updated><title type='text'>I tried to use that some time ago, but did not man...</title><content type='html'>I tried to use that some time ago, but did not manage to print without &amp;#39;\n&amp;#39; so this does&amp;#39;nt work&lt;BR/&gt;&lt;BR/&gt;#!/usr/bin/env python&lt;BR/&gt;import time&lt;BR/&gt;&lt;BR/&gt;for i in range(100):&lt;BR/&gt;    time.sleep(.01)&lt;BR/&gt;    print &amp;#39;\r&amp;#39;+i*&amp;#39;=&amp;#39;+&amp;#39;&amp;gt;&amp;#39;&lt;BR/&gt;&lt;BR/&gt;any idea?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/8855076159870801638'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/8855076159870801638'/><link rel='alternate' type='text/html' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html?showComment=1227564240000#c8855076159870801638' title=''/><author><name>Gabriel</name><uri>http://www.blogger.com/profile/15201248057871786129</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html' ref='tag:blogger.com,1999:blog-36506138.post-3590371759556102549' source='http://www.blogger.com/feeds/36506138/posts/default/3590371759556102549' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-36506138.post-2068786001638558362</id><published>2008-11-24T16:10:00.000-05:00</published><updated>2008-11-24T16:10:00.000-05:00</updated><title type='text'>Thats awesome. I always wondered how that worked.....</title><content type='html'>Thats awesome. I always wondered how that worked...</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/2068786001638558362'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/2068786001638558362'/><link rel='alternate' type='text/html' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html?showComment=1227561000000#c2068786001638558362' title=''/><author><name>Dougal</name><uri>http://www.blogger.com/profile/09183581228040499732</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html' ref='tag:blogger.com,1999:blog-36506138.post-3590371759556102549' source='http://www.blogger.com/feeds/36506138/posts/default/3590371759556102549' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-36506138.post-7792849103219431414</id><published>2008-11-24T16:08:00.000-05:00</published><updated>2008-11-24T16:08:00.000-05:00</updated><title type='text'>You and rapid research; Don't you have a job? ;^) ...</title><content type='html'>You and rapid research; Don't you have a job? ;^) Again, thanks for the help.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/7792849103219431414'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/36506138/3590371759556102549/comments/default/7792849103219431414'/><link rel='alternate' type='text/html' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html?showComment=1227560880000#c7792849103219431414' title=''/><author><name>Mr. New Hacker</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blag.whit537.org/2008/11/use-for-carriage-return.html' ref='tag:blogger.com,1999:blog-36506138.post-3590371759556102549' source='http://www.blogger.com/feeds/36506138/posts/default/3590371759556102549' type='text/html'/></entry></feed>