How is this list expanded with the slicing assignment? – stackoverflow.com

I came across the following code (sort of): my_list = [1, [2, 3, 4], 5] my_list[1:2] = my_list[1] After running these two lines, the variable my_list will be [1, 2, 3, 4, 5]. Pretty useful for ...

from Hot Questions - Stack Exchange OnStackOverflow
via Blogspot

Share this

0 Comment to "How is this list expanded with the slicing assignment? – stackoverflow.com"