How python combines two lists into a dictionary
This article will explain in detail how python combines the two lists into a dictionary. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Combine two lists into a dictionary
The zip code function has many advantages in python. Using the zip function, we can create dictionaries from two lists.
List_1 = ["One", "Two", "Three"] list_2 = [1Mae 2Mae 3] dictionary = dict (zip (list_1, list_2)) print (dictionary)
Output quantity
{'Two': 2,' One': 1, 'Three': 3} this is the end of the article on "how python combines two lists into dictionaries". I hope the above content can be helpful to you so that you can learn more knowledge. if you think the article is good, please share it for more people to see.