例子一
a,b = [1,2]
print(a)
print(b)
>>>a=1
>>>b=2
例子二
product_list = [
('Mac','9000'),
('kindel','800'),
('tesla','900000'),
('python_book','105'),
('bike','2000'),
]
for i ,v in enumerate(product_list):
print(i,'>>>',v)
>>> 1 >>> ('Mac', '9000')
2 >>> ('kindel', '800')
3 >>> ('tesla', '900000')
4 >>> ('python_book', '105')
5 >>> ('bike', '2000')
例子三
product_list = [
('Mac','9000'),
('kindel','800'),
('tesla','900000'),
('python_book','105'),
('bike','2000'),
]
for i ,v in enumerate(product_list):
print(i)
print(v)
>>> 1
('Mac', '9000')
2
('kindel', '800')
3
('tesla', '900000')
4
('python_book', '105')
5
('bike', '2000')