]> code.communitydata.science - rises_declines_wikia_code.git/blob - mediawiki_dump_tools/Mediawiki-Utilities/examples/xml_dump.iteration.py
add copy of the GPL
[rises_declines_wikia_code.git] / mediawiki_dump_tools / Mediawiki-Utilities / examples / xml_dump.iteration.py
1 """
2 Prints out all rev_ids that appear in dump.xml.
3 """
4 from mw.xml_dump import Iterator
5
6 # Construct dump file iterator
7 dump = Iterator.from_file(open("examples/dump.xml"))
8
9 # Iterate through pages
10 for page in dump:
11
12         # Iterate through a page's revisions
13         for revision in page:
14                 print(revision.id)

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