I have a file that has some dicts and list that I pickle (roughly 900 lines) that I don't want in my main script. I then do the following.
myDicts = [DictOne, DictTwo, ListOne, ListTwo]
pickle.dump(myDicts, open("all.p", "wb"))
this creates the all.p file which I load in my script.
myDicts = pickle.load( open ("all.p", "rb") )
What I don't know is how to access these Dictionaries now. How do I use the imported dictionaries? I can print the length or the entire list so I know the data is there, but I have no clue on how to access it, checked out some of the post here but I can't figure it out.
I tried
I would normally do something like this:
if blah == "blah" and sum([x in "text" for x in DictOne]):
so I tried doing this:
if blah == "blah" and sum([x in "text" for x in myDicts(DictOne)]):
Is there a easy way to just save the dictionary/list back to a dictionary/list?
DictOne = myDicts('DictOne')
ListOne = myDicts('ListOne')
or if I have
if flaga:
list=mydicts('ListOne')
elif flagb:
list=mydicts('ListTwo')