元组和元组解包tuple元组名=( , )>>> place=(1,2)
>>> print('Longitude:',place[0])
Longitude: 1
>>> print('Latitude:',place[1])
Latitude: 2元组解包--批量数据批量赋值>>> dimensions=1,2,3
>>> length,width,hight=dimensions
>>> length
1
>>> width
2
>>> hight
3
>>> length,width,hight=dimensions
>>>print('The dimensions are'+str(length)+'*'+str(width)+'*'+str(hight))
The dimensions are1*2
技术
· 2019-01-22
· 306 人浏览
一只胖橘