If you print what (voterlist) returns.. this is what it looks like:
Those pairings are the hallmarks of a dictionary variable, and yet it insists it's a list.
If you print what (voterlist) returns.. this is what it looks like:
Those pairings are the hallmarks of a dictionary variable, and yet it insists it's a list.
Since it's
[]
, it's a list.From what I can see, [] is a list, and {} is a dictionary, so [{}], .. is as @rimicane says, a list of dictionaries.
Dictionary
List
It seems there is a such a thing, which I wasn't aware of. The regular 'in' operator as a search does not work on this type so I just messed around with it until I found something that did!
https://pythonexamples.org/python-list-of-dictionaries/
It's a list of JSONs, actually.
for thing in list: if thing['voter'] == 'thingey': do stuff
Something like this should work.
Yes, that's exactly what I used.
for item in voterlist: if item['voter'] == strvoter:
ok, still a list type ( or better say a list of dictionaries):
[ { }, { }, { } ... { } ]