How do I flatten nested tuples?

Phyti

How do I sum the phone and email with the correspondent name of this list:

list_key_value = [['Jibs', ('251871', '[email protected]')], 
                  ['Marco', ('0000000', '[email protected]')], 
                  ['Richard', ('099099', '[email protected]')]]

Like this:

[['Jibs', '251871', '[email protected]'], 
 ['Marco', '0000000', '[email protected]'],
 ['Richard', '099099', '[email protected]']]

Since it came from this command in Python 3.5:

list_key_value=[ [k,v] for k,v in dct.items()]
print(list_key_value)
Zah

In Python 3.5 you can do

list_key_value = [[name, *tp] for (name, tp) in list_key_value]

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related