I have many lists in this format:
['1', 'O1', '', '', '', '0.0000', '0.0000', '', '']
['2', 'AP', '', '', '', '35.0000', '105.0000', '', '']
['3', 'EU', '', '', '', '47.0000', '8.0000', '', '']
I need to create a dictionary with key as the first element in the list and value as the entire list. None of the keys are repeating. What is the best way to do that?
If your indexes are sequential integers, you may use a list instead of a dict:
use it only if it really fits your problem, though.
put all your lists in another list and do this:
This basically gets the first element and puts it as a key in
my_dict
and put the list as the value.