Is there a way I can compare two URLs regardless of their protocol so that https://www.google.com
and www.google.com/
are the same URL?
You could use urlparse:
from urllib.parse import urlparse
u1 = urlparse('https://www.google.com')
u2 = urlparse('http://www.google.com/')
u3 = urlparse('ftp://www.google.com/som/ting/else')
print(u1.netloc == u2.netloc == u3.netloc)
Out:
True