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.


    string slicing

    Pythonista
    3
    4
    3013
    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.
    • SteppenwolfUA
      SteppenwolfUA last edited by

      Hi all!

      I get an error in Pythonista, but not in Idle on desktop

      S = 'abcedfghijklm'
      print S[5:1:−1]

      What seems to be the problem here?

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

        I'm not getting an error here, it prints fedc, as expected. What kind of error do you get?

        1 Reply Last reply Reply Quote 1
        • ccc
          ccc last edited by ccc

          Your -1 has a dash character instead of a minus sign character. If you change it to a minus sign then the world will become a better place.

          SteppenwolfUA 1 Reply Last reply Reply Quote 2
          • SteppenwolfUA
            SteppenwolfUA @ccc last edited by

            @ccc Thanx a lot. I must have copied it from somewhere unexpecting a dash instead of a minus. Well, lesson learned. The traps lurking behind an innocent facade...

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