Created
April 25, 2021 04:58
-
-
Save Xzonn/d07820dc1ca02b9510675f38a6ed7c75 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import xml.dom.minidom as xmldom | |
w = os.walk("./") | |
f = open("export.txt", "w", 1024 * 16, "utf-8") | |
for root, dirs, files in w: | |
for file in files: | |
if file.endswith(".kup"): | |
dom = xmldom.parse(os.path.join(root, file)) | |
entries = dom.getElementsByTagName("entry") | |
if len(entries) > 0: | |
f.write(os.path.join(root, file) + "\n") | |
for entry in entries: | |
name = entry.getAttribute("name") | |
text = entry.getElementsByTagName("original")[0].firstChild.data.replace("\\", "\\\\").replace("\n", "\\n").replace("\t", "\\t") | |
f.write(f"{name}\t{text}\n") | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment