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.


    Inverted Commas in Strings

    Pythonista
    2
    5
    1785
    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.
    • TomD
      TomD last edited by

      I have a data file that I sent to UTF8 which puts the inverted comma character in its output.
      How do I detect and remove the “ character from a string? Trying to define is as “”” i.e. 3 “ in a row, is overidden by the editor to become 4 “ in a row. It will not treat the “ character as a character.

      cvp 1 Reply Last reply Reply Quote 0
      • cvp
        cvp @TomD last edited by

        @TomD Try (or I didn't understand)

        a = 'hello “friend“'
        print(a)
        print(a.replace('“',''))
        
        1 Reply Last reply Reply Quote 0
        • TomD
          TomD last edited by

          @CVP, you do seem to understand but it doesn’t change the output. Syntax is good but the printed line is still:

          Hello “Friend”

          cvp 1 Reply Last reply Reply Quote 0
          • cvp
            cvp @TomD last edited by

            @TomD my print output:

            hello “friend“
            hello friend
            
            1 Reply Last reply Reply Quote 0
            • TomD
              TomD last edited by

              Works now. I must have had a transcription error. Thankyou

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