Blog Logo
  • Home
  • About

Python dict from two lists

by Drew Engelson — 05 Apr 2009

key_list = ['x', 'y', 'z']
value_list = [0, 1, 2]
combined_dict = dict(zip(key_list, value_list))
print combined_dict{'x': 0, 'y': 1, 'z': 2}
Drew Engelson
Author

Drew Engelson

https://tomatohater.com

I currently lead the Cloud Foundation Services team at Starbucks. We are building the Starbucks PaaS to allow digital platforms to be deployed globally with a focus on automation, scalability, performance, security, and developer experience.

Prior to Starbucks, I led Celerity's Technology Innovation and Architecture practice and founded Zoombit and served in technology leadership at Huge and PBS.

Yes. I seriously hate tomatoes.

All content copyright Tomatohater © 2006-2021 • All rights reserved.
0.06g of CO2/viewWebsite Carbon
 Cleaner than 95% of pages tested