%解压序列到不同的变量中
1 x = ('Christopher', 'Brooks', 'brooksch@umich.edu') 2 fname, lname, email = x
1 fname
'Christopher'
1 lname
'Brooks'
%确保变量的数量和解压的值相同
1 x = ('Christopher', 'Brooks', 'brooksch@umich.edu', 'Ann Arbor') 2 fname, lname, email = x
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-36-9ce70064f53e> in <module>()
1 x = ('Christopher', 'Brooks', 'brooksch@umich.edu', 'Ann Arbor')
----> 2 fname, lname, email = x
ValueError: too many values to unpack (expected 3)