Irmen de Jong <irmen.nos...@xs4all.nl> wrote: > On 30-1-2017 18:58, Chris Green wrote: > > I want to parse some XML data, it's the address book data from the > > linux program osmo. The file I want to parse is like this:- > > > > [snip] > > > > > I basically want to be able to extract the data and output in other > > formats - e.g. write to a Sqlite3 database and/or CSV. > > > > So what do I need to import (and probably install first) to do this? > > No need to install anything. Python has batteries included. > > Parse your XML with xml.etree.ElementTree > [https://docs.python.org/3/library/xml.etree.elementtree.html] > Read/write CSV with csv > [https://docs.python.org/3/library/csv.html] > Put stuff in sqlite3 database and query it using sqlite3 > [https://docs.python.org/3/library/sqlite3.html] >
Thanks, it was the ElementTree bit I didn't know. Searching for 'Python XML' produces so many hits it's difficult to see what's necessary/best. -- Chris Green ยท -- https://mail.python.org/mailman/listinfo/python-list