首页 > 编程语言 > 详细

python 将元组解析为多个参数

时间:2018-11-12 23:22:41      阅读:217      评论:0      收藏:0      [点我收藏+]

 

#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 将元组解析为多个参数

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!