How to merge two tuples in Python?

前端 未结 4 663
日久生厌
日久生厌 2020-12-29 19:53

How to convert the following tuple:

from:

((\'aa\', \'bb\', \'cc\'), \'dd\')

to:

(\'aa\', \'bb\', \'cc\', \'dd\')
         


        
4条回答
  •  借酒劲吻你
    2020-12-29 20:19

    >>> tuple(j for i in (('aa', 'bb', 'cc'), 'dd') for j in (i if isinstance(i, tuple) else (i,)))
    ('aa', 'bb', 'cc', 'dd')
    

提交回复
热议问题