[Tutor] Backspace Escape Sequence; \b

Steven D'Aprano steve at pearwood.info
Tue Feb 7 19:18:35 CET 2012


Peter Otten wrote:
> Garland W. Binns wrote:
> 
>> Could someone please tell me a common or semi-frequent scenario in which a
>> person would use a backspace escape sequence?
> 
> Does
> 
> $ python -c 'print "this is b\bbo\bol\bld\bd"' | less
> 
> qualify? If you are using (e. g.) Linux this technique is used to show some 
> text in boldface 

Gah, that has got to be the ugliest hack in the universe.

I don't think that is guaranteed to work everywhere. less supports the \b 
trick, but the Python interactive interpreter doesn't support it directly.



-- 
Steven


More information about the Tutor mailing list