Rosetta Code/Count examples: Difference between revisions
Content added Content deleted
m (→{{header|Ruby}}: minor improvement; method names mostly) |
|||
Line 592:
=={{header|Python}}==
<lang python>import urllib, xml.dom.minidom
Line 601 ⟶ 600:
for i in xml.dom.minidom.parseString(x.read()).getElementsByTagName("cm"):
t = i.getAttribute('title').replace(" ", "_")
y = urllib.urlopen("http://www.rosettacode.org/w/index.php?title=%s&action=raw" % t.encode('utf-8'))
tasks.append( y.read().lower().count("{{header|") )
print t.replace("_", " ") + ": %d examples." % tasks[-1]
|