fst = dict(zip(["listItems", "findCom", "findID"],map((lambda sides:(lambda p:map(lambda pat:(__import__('re').findall(pat,str(__import__('urllib').urlopen("http://faq.torinet.de/ausgabe1.php").read()))),([sides[0] + str(p) + sides[1]])))),[("<tr><[^<]+>(\d+)<[^<]+><[^<]+>([^<]+)<[^<]+><[^<]+>([^<]+)<[^<]+>","</tr>"),(">","<[^<]+><[^<]+>([^<]+)<"),(">(\d+)<[^<]+><[^<]+>","<")])))
import urllib, re
page = str(urllib.urlopen("http://faq.torinet.de/ausgabe1.php").read())
pats = [">(\d+)<", "\d+<.*>([^<>]+)", "(http[^\s<>]+)"]
output = map(lambda pat: (re.findall(pat,page)), pats)
_docs_
Old code
Old, old code
Old, old, old code
output
I never had the chance to learn it, but
I like how it simplify the output to a minimun.
One question, do you find Python more complex or simpler than
HTML and PHP ?. I might learn it
import urllib.request, re
urlList = str(urllib.request.urlopen("http://faq.torinet.de/ausgabe1.php").read())
pats = [">(\d+)<", "\d+<[^<>]*><[^<>]*>([^<>]+)", "(http://[^\s<>]+)"]
def query(n): return (re.findall(pats[n],urlList),len(re.findall(pats[n],urlList)))
import urllib.request, re
urlList = str(urllib.request.urlopen("http://faq.torinet.de/ausgabe1.php").read())
pats = [">(\d+)<", "\d+<[^<>]*><[^<>]*>([^<>]+)", "(http[^\s<>]+)"]; fs = []
def makeQ(pat): return lambda: (re.findall(pat,urlList),len(re.findall(pat,urlList)))
for pat in pats: fs.append(makeQ(pat))
>>> fs
[<function <lambda> at 0x0000000003283748>, <function <lambda> at 0x00000000033F80C8>, <function <lambda> at 0x00000000033F8148>]
>>> fs[0]
<function <lambda> at 0x0000000003283748>
>>> fs[0]()
(['25', '29', '34', '35', '36', '37', '38', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74'], 42)
import urllib, re
page = str(urllib.urlopen("http://faq.torinet.de/ausgabe1.php").read())
pats = [">(\d+)<", "\d+<.*>([^<>]+)", "(http[^\s<>]+)"]
output = map(lambda pat: (re.findall(pat,page)), pats)
_docs_
fst = dict(zip(["listItems", "findCom", "findID"],map((lambda sides:(lambda p:map(lambda pat:(__import__('re').findall(pat,str(__import__('urllib').urlopen("http://faq.torinet.de/ausgabe1.php").read()))),([sides[0] + str(p) + sides[1]])))),[("<tr><[^<]+>(\d+)<[^<]+><[^<]+>([^<]+)<[^<]+><[^<]+>([^<]+)<[^<]+>","</tr>"),(">","<[^<]+><[^<]+>([^<]+)<"),(">(\d+)<[^<]+><[^<]+>","<")])))
ansr = input("Yes or No?: ")
while sum1 > 21:
if ansr == "Yes":