Colab

a,b,c = [1,2]


    ---------------------------------------------------------------------------

    ValueError                                Traceback (most recent call last)

    <ipython-input-1-5c66098634d6> in <module>
    ----> 1 a,b,c = [1,2]
    

    ValueError: not enough values to unpack (expected 3, got 2)


a,b,c = [1,2,3,4]


    ---------------------------------------------------------------------------

    ValueError                                Traceback (most recent call last)

    <ipython-input-2-f87a2ac6aab3> in <module>
    ----> 1 a,b,c = [1,2,3,4]
    

    ValueError: too many values to unpack (expected 3)


a,b,c = [1,2,3]

csv = """\
name, age, country, ...
avi cohen, 30, israel
ben hur, 25. united kingdom
can davidovich, 40, georgia
david ben shalem, 60, united states of america
efrat ben dagan levi, 25, united arab emirates
"""

lines = csv.splitlines()
header, *data = lines

header

'name, age, country'
*first_columns, last_column = header.split(",")

first_columns

['name', ' age']
last_column

' country'
first_column, *other_columns, last_column = header.split(",")

first_column

'name'
last_column

' country'
other_columns

[' age']
name, age, country, *more_columns = header.split(',')

more_columns

[]