can I have a list that I use formkeys to convert it into a dictionary and the values of the dictionary be their indexes of the list?
for example my list is ["a", "b", "c", "d", "e"]
and if I use formkeys, I want it will be {"a" :0 , "b" :1 , "c" :2 , "d" :3 , "e" :4 }
could you tell me how can I do it?
or if you know another way that it’s order is less than this way (in python), please tell me.
>Solution :
Suppose lst = ['a', 'b', 'c' ...]:
dict = {a: b for b,a in enumerate(lst)}