Python: Map Multiple Lists into a Dictionary

preview_player
Показать описание
Python: Map Multiple Lists into a Dictionary

Here, I map a list of cities, and a separate list of countries into a single dictionary.
Рекомендации по теме
Комментарии
Автор

Thank you for the explanation. The humor is right up my ally... "Really?! What do you want me to do with that?!" Thanks for making my coding experience entertaining. :)

HandyDandyRight
Автор

I like how you cover the practical aspects of coding. Lists are huge! And being able to make lists, definitions and assign them values that I can recall is a big deal for me. Thanks!

df
Автор

I like the calm, rational way you explain the process. thank you very much for your help

sandro
Автор

THE best video explanation on this topic. Thank you!

kayrafeliz
Автор

This video was the thing i needed to see. Thank you!

syrenka
Автор

cp = dict(zip(c, p))
or
cp = {k:v for k, v in zip(c, p)}
or
cp = {c[i]:p[i] for i in range(len(c))}
etc.

dfw-kz
Автор

cp = {}
for y, x in enumerate(c):
cp[x] = p[y]

same results right?

deli
Автор

Thank you, Mr. Boole! Such a great explanation.

domyu
Автор

Thank you! Thank you! Thank you!
I often have to make dictionaries from columns in my database. I've been using zip. But it's a drag constructing a zip statement for each dictionary I want to create. This is so much simpler and faster!

belleriveblvd
Автор

Ths is great! Even though it is a little outdated, still the best tutorial out there, thanks!

Lexii
Автор

You safe my life! I'm forever grateful to you!!!

s.e.
Автор

Thank you so much!!!!. This was really helpful.

venugopalsg
Автор

what about dictionaries that have keys?

dailypotstirrer
Автор

True Python way is cp = dict(map(c, p))

vadimshatalov
Автор

this is a terrible way to do it, you should use dict comprehension and do it in one line

georgesmith
join shbcf.ru