Skip to content

Latest commit

 

History

History
8 lines (7 loc) · 245 Bytes

convert-list-to-dictionary-with-indexes.md

File metadata and controls

8 lines (7 loc) · 245 Bytes

Convert list to dictionary with indexes

>>> lst = ['A','B','C']
>>> {k: v for v, k in enumerate(lst)}
{'A': 0, 'C': 2, 'B': 1}

Source