码迷,mamicode.com
首页 > 编程语言 > 详细

python 将元组解析为多个参数

时间:2018-11-13 00:01:13      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:must   color   var   col   number   pack   ems   code   pac   

 

#create a tuple
tuplex = 4, 8, 3
print(tuplex)
n1, n2, n3 = tuplex
#unpack a tuple in variables
print(n1 + n2 + n3)
#the number of variables must be equal to the number of items of the tuple
n1, n2, n3, n4 = tuplex

 

python 将元组解析为多个参数

标签:must   color   var   col   number   pack   ems   code   pac   

原文地址:https://www.cnblogs.com/sea-stream/p/9949563.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!