I need to populate dictionary from array. I’ve done in three lines and i’m trying to do it shortest as it can be. Is there way how to populate it in single line?
a = [['test',154],['test2',256]]
d = dict()
for b in a:
d[b[0]] = b[1]
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Just
dict🙂