You need to clarify the problem a bit. I will make several assumptions: 1) your data is static, and you just want to look for it, 2) you have enough memory to store it.
If the applicationโs launch speed is not critical, the data format is up to you, just as you can get it in Python memory. Use simple data types (dicts, lists, strings) to store data, not XML graphics, if you want to quickly access it. You might consider writing your own lightweight class to express nodes and store references to other nodes in a dict or array.
If application startup time is critical, consider loading your data into a Python program and etching it into a file; you can then load the structured data structure (which should be very fast) in the production application.
If, on the other hand, your data is too large to fit in memory or you want to constantly modify it, you can use SQL for storage (external server or SQLite database) or ZODB (Python object database).
source share