The BEST Way To Combine Python Lists! #python #programming #coding

preview_player
Показать описание
How to combine multiple lists in Python!
Рекомендации по теме
Комментарии
Автор

Unpacking operator looks suspiciously like a pointer

HanWae
Автор

Finally I see someone who also uses rpg themed examples to explain code, love it!

StealerSlain
Автор

Unpacking also works with dictonaries:

d1 = {'a':1, 'b':2, 'c':3}
d2 = {'d':4, 'e':5, 'f': 6}

d3 = dict(**d1, **d2)

kpbendeguz
Автор

Tbh, the best one is using itertools module (chain and chain.from_iterable). Getting an iterator saves memory and still its possible to turn it into any of iterables or iterate through this.

umion
Автор

there is chain and chain from iterable, from the package itertools, different tools for different occasions, itertools is better for iterations, this method is better for lists

alenasenie
Автор

How can I get this:
[bow, ruby, sword, helmet, gold, shield] ?

jymbo
Автор

i didnt know python had destructuring like javascript

jeffery_tang
Автор

Thanks a lot! Can u tell a name of the your theme?

trooman
Автор

How do I add the suggestion box to my python notebook? Like when you type something it suggests what's you're inputting

faroukbrimah
Автор

Whoa wait, how did you comment both lines out with the # at the same time? Does highlighting the lines have anything to do with it?

neonsilver
Автор

Is one less resource intensive than the other

guptadagger
Автор

Thank you this is very nice to know.

Also
BRO WHAT I'm the 2, 200th like EXACTLY

TemporanFact
Автор

Не понял, в чем существенная разница?

_mrmark
Автор

You make more sense then college professors

pkmnrangermirkat
Автор

The expert difficulty level way:
list(itertools.chain.from_iterable(list1, list2, list3))

qbert
Автор

itertools.chain.from_iterable is my goto choice

Imboredas