Answers for "create 2d list dictionary"

1

create 2d list dictionary

d = {}
for elem in l:
    if elem[1] in d:
        d[elem[1]].append(elem[0])
    else:
        d[elem[1]] = [elem[0]]
Posted by: Guest on November-03-2020

Python Answers by Framework

Browse Popular Code Answers by Language