http://example.com/page.php
//example.com/page2.php
http://example.com/google.com
http://example.com/page4.php
example.com/google.com
links = [
'http://example.com/page.php',
'//example.com/page2.php',
'google.com',
'http://amazon.com'
'page3.php',
'/page4.php',
]
for href in links:
if not urlparse(href).netloc or 'example.com' in href:
print(href)
# result:
http://example.com/page.php
//example.com/page2.php
google.com
/page4.php
# а должно быть:
http://example.com/page.php
//example.com/page2.php
page3.php
/page4.php
links = [
'http://example.com/page.php',
'//example.com/page2.php',
'page3.php',
'/page4.php',
]
for link in links:
if not urlparse(link['href']).netloc:
print(link['href'])
<a href='help.php'>help</a>
куда она будет вести?) Вы читали мою тему вообще?))