Rosetta Code/Rank languages by popularity: Difference between revisions

Line 47:
 
<lang python>import urllib, re
 
def key1(x):
return int(x.split()[0])
 
a = urllib.urlopen("http://www.rosettacode.org/w/index.php?title=Special:Categories&limit=500")
 
entries = []
 
for line in a:
match = re.search('>([^<>]*)</a> \((\d+) members?\)', line)
Line 62 ⟶ 58:
a.close()
 
for c, line in enumerate(sorted(entries, key=key1lambda x: int(x.split()[0]), reverse=True), start=1):
print "%3d. %s" % (c, line)</lang>
 
Anonymous user