Prompt Use the FirstParser.py starter code and read in the HTML of any webpage of your choice! (Pick something safe and
Posted: Sat May 14, 2022 2:53 pm
Prompt Use the FirstParser.py starter code and read in the HTML of any webpage of your choice! (Pick something safe and school appropriate) Find a pattern on the page (such as headers, or lists, or images) and add them to a list. For example, add all of the lines that have images in them into a list. Or all h1 or h4 tags are added to a list. This will be unique to your code. I'm just looking that you were able to read in an HTML file and do something with it. Nothing fancy!
= import urllib.request, urllib.parse, urllib.error import re import ssl # Ignore SSL certificate errors ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE url = input('Enter - ') html = urllib.request.urlopen(url, context=ctx).read() = - #convert object into string, then split into list fullpage = str(html).split("\\n")
= import urllib.request, urllib.parse, urllib.error import re import ssl # Ignore SSL certificate errors ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE url = input('Enter - ') html = urllib.request.urlopen(url, context=ctx).read() = - #convert object into string, then split into list fullpage = str(html).split("\\n")