Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Outputting \b in python?

 
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to output

> \b

, so I do:

print('\b')
and a fancy symbol is outputted instaed. This doesn't happen for other letters? So how do I actually output

> \b

? Sorry this question is simple but not much comes in google when you do a search for this character combination...
 
Luke Murphy
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Luke Murphy wrote:I want to output

> \b

, so I do:

print('\b')
and a fancy symbol is outputted instaed. This doesn't happen for other letters? So how do I actually output

> \b

? Sorry this question is simple but not much comes in google when you do a search for this character combination...



Answer...

print('\\b')
 
Bartender
Posts: 2407
36
Scala Python Oracle Postgres Database Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You probably figured out by now that '\b' is a special character (backspace), just as '\t' is a tab, and '\n' is a newline, etc.
 
Then YOU must do the pig's work! Read this tiny ad. READ IT!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic