Комментарии:
Great video, thanks! Question: Is it possible to unpack the iterable and, at the same time, apply a function to each of the unpacked elements? For example, I have a list of strings that have trailing whitespaces that I want removed. I was thinking of calling the strip() method on each element as the list is unpacked. I tried different ways but I was not successful, so I ended up using list comprehension. Is something like this possible with the unpacking operator?
ОтветитьShort but useful!
ОтветитьThank you! This makes a little more sense now and my brain broke slightly.
ОтветитьThis was a great video. Amazing explanation
ОтветитьI have good knowledge of python and am completely confused.
ОтветитьNote: basically asterisk(*) operator is the default way of merging two iterables
Ответитьthank you very much for your great content! :) very interesting and clear
ОтветитьThank you very much!!
ОтветитьThank you for this clear explanation!
Ответитьgood explanation. Thank you! What video editing program you use ?
ОтветитьWell explained! Thank you.
ОтветитьHey Dan
At first i didn't understand the trick (merging two dictionaries) that appears on your real python website .
But now it's crystal clear
Thank you Dan barder
Expecting more such tricks from real python team .
Thank you, that was helpful... 😊
Ответитьgood video tutorial:
>>> *a, = "RealPython"
>>> print(*a)
R e a l P y t h o n
>>> print(a)
['R', 'e', 'a', 'l', 'P', 'y', 't', 'h', 'o', 'n']
>>> zeros = (0,) * 8
>>> print(zeros)
(0, 0, 0, 0, 0, 0, 0, 0)
>>> *a,
('R', 'e', 'a', 'l', 'P', 'y', 't', 'h', 'o', 'n')
>>> *c, b = a
>>> *c,
('R', 'e', 'a', 'l', 'P', 'y', 't', 'h', 'o')
Nice
ОтветитьWant to start learning machine learning, data science or AI and looking for good resources. Start learning from top industry experts bloggers, articles, books and video lectures in one place on OpenAcademy. Find on Google PlayStore.
Ответить