omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. TomD

    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.


    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 12
    • Best 0
    • Controversial 0
    • Groups 0

    TomD

    @TomD

    0
    Reputation
    441
    Profile views
    12
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    TomD Unfollow Follow

    Latest posts made by TomD

    • RE: Inverted Commas in Strings

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

      posted in Pythonista
      TomD
      TomD
    • RE: Inverted Commas in Strings

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

      Hello “Friend”

      posted in Pythonista
      TomD
      TomD
    • Inverted Commas in Strings

      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.

      posted in Pythonista
      TomD
      TomD
    • RE: Webpage Slices are Different from what is There

      I much appreciate. You have helped me around an obstacle

      posted in Pythonista
      TomD
      TomD
    • RE: Webpage Slices are Different from what is There

      I see so I could work on that utf8 more easily

      posted in Pythonista
      TomD
      TomD
    • RE: Webpage Slices are Different from what is There

      It doesn't like
      print (st)

      posted in Pythonista
      TomD
      TomD
    • RE: Webpage Slices are Different from what is There

      Thanks CVP. That has me onto something.
      I am data scraping. Maybe better off using a package like beautifulsoup?

      posted in Pythonista
      TomD
      TomD
    • RE: Webpage Slices are Different from what is There

      CVP, so no printed string slice takes the html one character at a time. It combines them into groups and adds apostrophes.

      posted in Pythonista
      TomD
      TomD
    • RE: Webpage Slices are Different from what is There

      #The "with" statement overflows into the next line due to this narrow comment box

      import urllib.request
      tda=str
      with urllib.request.urlopen("https://www.asx.com.au/asx/statistics/todayAnns.do") as response
      tda=response.read()

      #Print the entire html string so I know what is in it
      #The output of this print statement starts:
      #b'\r\n\r\n\r\n<!DOCTYPE

      print (tda)

      #Separately print the first 5 characters in the html string
      #The output of this is, including spaces between items:
      #b'\r' b'\n' b'\r' b'\n' b'\r'

      print (tda[0:1],tda[1:2],tda[2:3],tda[3:4],tda[4:5])

      #Print the first 5 characters in the string
      #The output of this is:
      #b'\r\n\r\n\r'

      print(tda[0:5])

      posted in Pythonista
      TomD
      TomD
    • Webpage Slices are Different from what is There

      I downloaded a webpage successfuly which looks correct in content. When printing slices the characters are different.

      Specifically, when I print the first character it shows the first plus the next 3 characters and an apostrophe on the end. So one character becomes 5 characters.

      On printing longer slices of the webpage the number of characters is also greater and the apostrophe is always added on the end.

      What is happening?

      Tom

      posted in Pythonista
      TomD
      TomD