omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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

    Pythonista
    4
    4
    2697
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Tornadoowl
      Tornadoowl last edited by

      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?

      Phuket2 1 Reply Last reply Reply Quote 0
      • Phuket2
        Phuket2 @Tornadoowl last edited by Phuket2

        @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)]'

        1 Reply Last reply Reply Quote 0
        • miwagner1
          miwagner1 last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • dgelessus
            dgelessus last edited by

            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.

            1 Reply Last reply Reply Quote 1
            • First post
              Last post
            Powered by NodeBB Forums | Contributors