Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python convert list to dict with index

>>> lst = ['A','B','C']
>>> {k: v for v, k in enumerate(lst)}
{'A': 0, 'C': 2, 'B': 1}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #convert #list #dict #index
ADD COMMENT
Topic
Name
1+1 =