Backspace behavior in Python statement, what is correct behavior of printing a '\b' in code?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/2856344/backspace-character-wiredness">backspace character wiredness</a>  </p>
</blockquote>



<p>I have noticed that
1. If I print only backspaces, i.e. a sequence of \b in Python, then it is completely blank.
2. If I print characters followed by backspaces i.e. 'sssss\b\b\b\b\b', then it will print the multiple 's' characters
But if I print something like 'ssss\b\b\b\baaaa', then the backspace, \b, will actually act like I am typing a backspace and delete the 's' characters.</p>

<p>I am using Python 2.6 on Windows XP. Is this expected behavior. If I try to get length of backspace character, it is printed as 1.</p>

<p>Here is my test code - </p>

<pre><code>&gt;&gt;&gt; print 'ssss\b\b\b\b\baaaaa'
aaaaa
&gt;&gt;&gt; print 'ssssssss\b\b\b\b\baaaaa'
sssaaaaa
&gt;&gt;&gt; print 'ssssssss\b\b\b\b\b'
ssssssss
&gt;&gt;&gt; print 'ssssssss\b\b\b\b\baaaaa'
sssaaaaa
&gt;&gt;&gt; print '\b\b\b\b\b'

&gt;&gt;&gt;
</code></pre>

<p>My question is- What is the expected behavior when I print '\b' in Python and why the deletion does work in only a particular case?</p>
