This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients Jared Bevis, ezio.melotti, martin.panter, mrabarnett
Date 2015-09-19.04:00:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1442635234.0.0.491843898602.issue25174@psf.upfronthosting.co.za>
In-reply-to
Content
Python itself doesn’t treat backspace specially. What you are probably seeing is the terminal interpreting the backspace specially by moving the cursor left (without erasing anything).

>>> s = "12345" + '\b' + '6'
>>> s
'12345\x086'
>>> s[5]  # ASCII code for backspace is 0x08
'\x08'

If you redirect the output to a file or other program, you will also see the backspace code is still there:

$ python2 -c 'print "12345" + "\b" + "6"' | hexdump -C
00000000  31 32 33 34 35 08 36 0a                           |12345.6.|
00000008
History
Date User Action Args
2015-09-19 04:00:34martin.pantersetrecipients: + martin.panter, ezio.melotti, mrabarnett, Jared Bevis
2015-09-19 04:00:34martin.pantersetmessageid: <1442635234.0.0.491843898602.issue25174@psf.upfronthosting.co.za>
2015-09-19 04:00:33martin.panterlinkissue25174 messages
2015-09-19 04:00:33martin.pantercreate