Reputation: 55
i have a simple line of code
print("Hello \bWorld!")
and the output instead of HelloWorld! is
what is the problem ? im using python 3.5. i took the code from w3school.com
Upvotes: 0
Views: 607
Reputation: 51683
Your console output is incapeable of displaying the '\b'
. This has nothing to do with python.
It works in Visual Studio: You can verify it by setting a breakpoint in your debugger and inspect the value (most IDEs have UTF-8 support) - the windows console f.e. has not.
Debugging output in Visual Studio:
vs. console output in windows:
and (here it looks like yours)
for
k = "Hello \bWorld!"
print(k)
Upvotes: 1
Reputation: 16792
\b
ASCII backspace ( BS ) removes previous character in Python 3.x:
print("ab\bc")
OUTPUT:
ac
In your case its not something related to Python but the console itself.
As I get:
print("Hello \bWorld") # HelloWorld
Upvotes: 1