如何迭代值对列表以将相应的值设置为等于新值列表?

2024-04-29 02:28:55 发布

您现在位置:Python中文网/ 问答频道 /正文

我认为我的问题最好用以下例子来解释:

new_values = [3, 2, 1]

pairs = [(value,whatever), (value2,whatever2), (value3,whatever3)]

我想将成对中的每个值设置为其各自的新值(新值)。换句话说,我想

pairs = [(3,whatever), (2,whatever2), (1,whatever3)]

最好的方法是什么


Tags: 方法newvalue例子valueswhateverpairs新值