Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Using \b in pythonista
-
I'm trying to use pythonista to do something like
print('abc\b123')
To output
ab123
But when I try it in app all I get is
abc123
Am I doing it wrong or am I missing something bigger?
-
@Tornadoowl , I am a beginner. But a quick search leads me to believe you are thinking Pythonista is Python 3.xx something. It's Python 2.7.6 I think. That b literal looks like it's a Python 3+ switch or whatever you call it
Edit.
sys.version
'2.7.5 (default, Dec 19 2015, 08:50:49) \n[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.1.76)]' -
It looks like its broken? Pythonista is running version 2.7.5 and my mac is running 2.7.10. Your simple print statement with the go back works fine on my mac.
-
In a string literal
\b
stands for some kind of ASCII character that is supposed to mean "move cursor one character to the left", which would allow overwriting previously printed text (on the same line). Pythonista's console is not a full terminal emulation, so it doesn't support"\b"
and other control characters like a "normal" terminal. If you run this code in IDLE or another IDE you'd probably get similar results.