In this post, we will solve Build a Stack Exchange Scraper HackerRank Solution. This problem (Build a Stack Exchange Scraper) is a part of HackerRank Regex series.
Solution – Build a Stack Exchange Scraper – HackerRank Solution
Python
import re, sys p1 = re.compile('<a href="/questions/([0-9]+).*>') p2 = re.compile('<a href="/questions/[0-9]+.*>(.*)</a>') p3 = re.compile('.*class="relativetime">(.*)</span>') a = sys.stdin.read() x = re.findall(p1, a) y = re.findall(p2, a) z = re.findall(p3, a) for i in range(len(x)): print(x[i].strip()+';'+y[i].strip()+';'+z[i].strip())
Note: This problem (Build a Stack Exchange Scraper) is generated by HackerRank but the solution is provided by CodingBroz. This tutorial is only for Educational and Learning purpose.