urls = ['http://www.url.com/foo-bar', 'http://www.url.com/foo-bar?t=baz',
    'www.url.com/baz-qux', 'www.url.com/foo-bar?t=baz']
unique = {''.join((u.netloc, u.path)) for u in map(urlparse, urls)}
print(unique)
Checking if element in list by substring