Datasets:
Download source/tests/solvers/tx_xml.py from Syndicate604/skills-desk: direct link, hf CLI and curl.
- Browser
- Download file 425 Bytes
-
https://huggingface.co/datasets/Syndicate604/skills-desk/resolve/main/source/tests/solvers/tx_xml.py
- Command line
-
hf download hf://datasets/Syndicate604/skills-desk/source/tests/solvers/tx_xml.py
-
curl -L -o tx_xml.py https://huggingface.co/datasets/Syndicate604/skills-desk/resolve/main/source/tests/solvers/tx_xml.py
425 Bytes
| import csv | |
| import xml.etree.ElementTree as ET | |
| w = csv.writer(open("catalog.csv", "w", newline="", encoding="utf-8")); w.writerow(["sku", "title", "price", "stock", "tags"]) | |
| for p in ET.parse("catalog.xml").getroot().findall("product"): | |
| st = p.find("stock") | |
| w.writerow([p.get("sku"), p.findtext("title"), p.findtext("price"), "" if st is None else st.text, | |
| ";".join(t.text for t in p.findall("tag"))]) | |