小编jor*_*mas的帖子

max in a list of tuples (Python)

I have this list of list of tuples

var1 = [
    [(10, '?'), (7, '?')],
    [(14, '?'), (2, '?')],
    [(2, '?'), (9, '?')],
    [(11, '?'), (10, '?')],
    [(11, '?'), (5, '?')]
]
Run Code Online (Sandbox Code Playgroud)

and I wanna extract the tuple with the maximun value which is the second one or var1[1]. I've used a lot of different codes during my programming but the one I'm using now and until now and didn't have any major issues is this one:

 maximo = max(var1, …
Run Code Online (Sandbox Code Playgroud)

python tuples list max

2
推荐指数
1
解决办法
58
查看次数

标签 统计

list ×1

max ×1

python ×1

tuples ×1