如何在python中展平元组

2022-01-19 00:00:00 python list flatten tuples

问题描述

我有一个列表的以下元素,该列表有 100 个元素长.

I have the following element of a list, and the list is 100 elements long.

[(50, (2.7387451803816479e-13, 219))]

如何将每个元素转换成这样?

How do I convert each element to look like this?

[(50, 2.7387451803816479e-13, 219)]


解决方案

[(a, b, c) for a, (b, c) in l]

元组打包和解包解决了这个问题.

相关文章