Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python unpack list

elems = [1, 2, 3, 4]
a, b, c, d = elems
print(a, b, c, d)
# 1 2 3 4

# or
a, *new_elems, d = elems
print(a)
print(new_elems)
print(d)
# 1
# [2, 3]
# 4
Source by itsmycode.com #
 
PREVIOUS NEXT
Tagged: #python #unpack #list
ADD COMMENT
Topic
Name
6+8 =