2 ms·
Well if you fancied this on your ebook reader, this new site makes it easier to do something like... with open(r"zen.html", "w") as f: pat = re.com
by heyitsnick 17y ago
Well if you fancied this on your ebook reader, this new site makes it easier to do something like...
with open(r"zen.html", "w") as f:
pat = re.compile(r'.*\<p class="header"\>(.*?)</p>.*!-- Display story -->(.*?)</div>', re.DOTALL)
for i in range(101):
url = "http://www.101zenstories.com/index.php?story=%s" % str(i + 1)
html = urlopen(url).read()
result = pat.match(html)
f.writelines(["<h2>%d. %s</h2>" % (i + 1, result.group(1)), result.group(2)])