Is there a way to map a list onto a dictionary? What I want to do is give it a function that will return the name of a key, and the value will be the original value. For example
Taking hints from other answers I achieved this using map operation. I am not sure if this exactly answers your question.
mylist = ["hello", "world"] def convert_to_dict( somelist ): return dict( map( lambda x: (x[0], x), somelist ) ) final_ans = convert_to_dict( mylist ) print final_ans