Posted on 16th September 2024|40 views
How can I create a python dictionary by enumerate function?
Posted on 16th September 2024| views
Here is the example
>>> li1=['xx','yy','zz']
>>> enum=enumerate(li1)
>>> enum
>>> di=dict((p,q) for p,q in enum)
>>> di
{0: 'xx', 1: 'yy', 2: 'zz'}