Created
May 6, 2016 06:38
-
-
Save Abdujabbar/ac1aa63f53f137da66831126a61a8dfa to your computer and use it in GitHub Desktop.
stepic solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import re | |
a = input() | |
b = input() | |
counter = 0 | |
r = requests.get(a) | |
found = False | |
while r.status_code == 200: | |
links = list(set(re.findall(r"https?://[\w\-.~/?:#\[\]@!$&'()*+,;=]+", str(r.content)))) | |
counter += 1 | |
if counter > 2: | |
break | |
if links: | |
link = links[0] | |
if counter == 2 and link == b: | |
found = True | |
break | |
r = requests.get(link) | |
else: | |
break | |
if counter == 2 and found: | |
print("Yes") | |
else: | |
print("No") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment