简体   繁体   English

“数字=(第一,第二)+休息”有什么作用?

[英]What does “numbers = (first, second) + rest” do?

What does numbers = (first, second) + rest do? numbers = (first, second) + rest有什么作用?

(first, second) is a tuple, so what does it mean to add something to a tuple? (first, second)是一个元组,那么在元组中添加一些东西是什么意思呢?

Although just a guess, it safe to assume rest is also tuple and you add 2 tuples, eg something like this虽然只是一个猜测,但可以安全地假设 rest 也是元组并且您添加 2 个元组,例如像这样

first = 1
second = 2
rest = (3, 4, 5)
numbers = (first, second) + rest
print(numbers)

output: output:

(1, 2, 3, 4, 5)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM