Skip to content

Instantly share code, notes, and snippets.

View borowis's full-sized avatar

Borys Zibrov borowis

View GitHub Profile
@borowis
borowis / xml_split.py
Last active September 2, 2017 14:07 — forked from benallard/xml_split.py
``./xml_split.py -M 8092 --split_on_tag "tu" big.xml`` --> split potentially huge big.xml into approximately 8 Mb chunks with names big.0.xml, big.1.xml etc. Split only on </tu> tags (can be omitted if you do not care).
#!/usr/bin/env python
import os
import xml.parsers.expat
from xml.sax.saxutils import escape
from optparse import OptionParser
from math import log10
DEBUG_MODE = False