]> code.communitydata.science - rises_declines_wikia_code.git/blob - mediawiki_dump_tools/Mediawiki-Utilities/examples/xml_dump.map.py
add copy of the GPL
[rises_declines_wikia_code.git] / mediawiki_dump_tools / Mediawiki-Utilities / examples / xml_dump.map.py
1 """
2 Processes two dump files.
3 """
4 from mw import xml_dump
5
6 files = ["examples/dump.xml", "examples/dump2.xml"]
7
8
9 def page_info(dump, path):
10     for page in dump:
11         yield page.id, page.namespace, page.title
12
13
14 for page_id, page_namespace, page_title in xml_dump.map(files, page_info):
15     print("\t".join([str(page_id), str(page_namespace), page_title]))

Community Data Science Collective || Want to submit a patch?