• mikael

    @cvp, have been following along again now that the update emails work again. Thank you, or anyone else who might have made that happen.

    posted in Pythonista read more
  • mikael

    And if you just need the text directly:

    from bs4 import BeautifulSoup
    
    html = '''
    <!doctype html>
    <html>
        <head>
            <meta charset="utf-8">
            <title>Title</title>
        <style type="text/css">
        /* CSS styles here... */
        </style>
        </head>
        
        <body>
        
        <h1>Hello</h1>
        
        </body>
        
    </html>
    '''
    
    soup = BeautifulSoup(html, "html5lib")
    
    # Strip empty lines and extra white space
    text = '\n'.join(
        line.strip() for line in soup.text.splitlines()
        if line.strip()
    )
    
    print(text)
    

    There’s also a library you could install to get a nicer text representation as markdown, where h1 titles are underlined etc.

    posted in Pythonista read more
  • mikael

    @cvp, thanks! Have been hacking more on the laptop lately.

    posted in Pythonista read more
  • mikael

    @rb, if we are talking something like a photo with rectangles, you could also use the iOS Vision framework, see here.

    I have a Python implementation lying around somewhere, let me know if that seems interesting.

    posted in Pythonista read more
  • mikael

    @rb, are the rectangles exactly "squared" or can they be in any position in the image? Are the rectangles solid colour and the background another colour, or is the background (say) white with (say) black rectangular outlines? Do you know what the colours are or can they be anything?

    posted in Pythonista read more
  • mikael

    @cvp, impressive! Know how hard these seemingly simple things can be.

    posted in Pythonista read more
  • mikael

    @samsonantony, as one possible building block. here is ObjC code that can be used to save a video clip slowed down without audio:
    https://stackoverflow.com/questions/17296999/how-to-do-slow-motion-video-in-ios

    posted in Pythonista read more
  • mikael

    @JonB, your post should be pinned to the top of the forum, wonder if @ccc has access.

    posted in Pythonista read more
  • mikael

    @Robert_Tompkins, I have the same issue, and no workaround.

    posted in Pythonista read more
  • mikael

    @talns100, as others have pointed out, int is a quick way to get the number. Always a good idea to wrap it in try ... except ValueError though, to either set a default or give the user some guidance on what you expected to receive.

    Usually, if all I want is an int, I prefer to use int(round(float(input()))), just to be that little bit more tolerant of users who input 1.0, for example.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!