I am trying to unpack set of phone numbers from a sequence, python shell in turn throws an invalid syntax error. I am using python 2.7.1. Here is the snippet
That functionality is only available in Python 3, an alternative is:
name, email, phone_numbers = record[0], record[1], record[2:]
Or something like:
>>> def f(name, email, *phone_numbers):
return name, email, phone_numbers
>>> f(*record)
('Dave', 'dave@example.com', ('773-555-1212', '847-555-1212'))
but that is pretty hacky IMO