Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,18 @@
|
|||
from urllib.request import urlopen, Request
|
||||
import xml.dom.minidom
|
||||
|
||||
r = Request(
|
||||
'https://www.rosettacode.org/mw/api.php?action=query&list=categorymembers&cmtitle=Category:Programming_Tasks&cmlimit=500&format=xml',
|
||||
headers={'User-Agent': 'Mozilla/5.0'})
|
||||
x = urlopen(r)
|
||||
|
||||
tasks = []
|
||||
for i in xml.dom.minidom.parseString(x.read()).getElementsByTagName('cm'):
|
||||
t = i.getAttribute('title').replace(' ', '_')
|
||||
r = Request(f'https://www.rosettacode.org/mw/index.php?title={t}&action=raw',
|
||||
headers={'User-Agent': 'Mozilla/5.0'})
|
||||
y = urlopen(r)
|
||||
tasks.append( y.read().lower().count(b'{{header|') )
|
||||
print(t.replace('_', ' ') + f': {tasks[-1]} examples.')
|
||||
|
||||
print(f'\nTotal: {sum(tasks)} examples.')
|
||||
Loading…
Add table
Add a link
Reference in a new issue