Search code examples
pythonpython-3.xutf-8python-3.5unicode-escapes

why does escape character \b shows an unknown character?


i have a simple line of code

 print("Hello \bWorld!") 

and the output instead of HelloWorld! is

enter image description here

what is the problem ? im using python 3.5. i took the code from w3school.com


Solution

  • 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:

    debugger output

    vs. console output in windows:

    output in console

    and (here it looks like yours)

    output in output

    for

    k = "Hello \bWorld!"
    print(k)