I'm trying to make a very small "database" using dictionary in python, that will ultimately be stored as json/text.
Right now it only stores a key (str or int) and value as list of more dictionaries and lists. But since dict only stores two items (keys & values) is there away to add a 3rd item without creating a new dict or list for data retrieval? I thought of changing keys into list of two values, but don't know how I'd be able to searching though the keys. I don't want to add more list and dictionary making to more difficult to parse through.
Do I need to use something else instead of dictionary, or am I just thinking about it all wrong?
DataBase = [
{9: [
{1: [
{100: "something"},
{200: "something else"}
]
},
{2: [
{112: "something different"},
{153: "blank"}
]
}
]
},
{99: [{}]},
{100: [{}]}
]
In a nutshell what I'm trying to do is pull data from csv and spreadsheets, and put into some sort of a database to be able to easily read and write to. So I think this is the best I was able to come up with, don't know if I can improve it even further.
Ex: Country,USA, State, NY, City, NYC, Zip, 10001, Name, John
{(Country, USA):
{(State, NY):
{(City, NYC):
{(Zip, 10001): {Name: John}, (Zip, 11001): {Name: Jane}}
}
{(State, LA): {(City, notNYC):
{(Zip, 00001): {Name: Joe, Name: Jame}
}
}