use two items as key to create dictionary python

use two items as key to create dictionary python

You can use any (hashable) object as a key for a python dictionary, so just use a tuple containing those two values as the key.

I believe you can use a tuple as the key for the dictionary. So youd have

mydict = {}
mydict[(usermac1,useragent1)] = [ [area1, videoid1, 10],[area1,videoid2,29]... ]

use two items as key to create dictionary python

Leave a Reply

Your email address will not be published. Required fields are marked *