I've got to find the images in a html source code. I'm using regex instead of html.parser because I know it better, but if you can explain to me how to use html parsing like you would a child, I'll be happy to go down that road too.
Can't use beautifulsoup, wish I could, but I got to learn to do this the hard way.
I've read through a lot of questions and answers on here on regex and html (example) so I'm aware of the feelings on this topic.
But hear me out!
Here's my coding attempt (Python 3):
import urllib.request
import re
website = urllib.request.urlopen('http://google.com')
html = website.read()
pat = re.compile (r'<img [^>]*src="([^"]+)')
img = pat.findall(html)
I double checked my regex on regex101.com and it works at finding the img link, but when I run it on IDLE, I get a syntax error and keeps highlighting the caret. Why?
I'm headed in the right direction... yes?
update: Hi, I was thinking may be I get short quick answer, but it seems I may touched a nerve in the community.
I am definitely new and terrible at programming, no way around that. I've been reading all the comments and I really appreciate all the help and patience users have shown me.