python - Joining tuples within a list -


i want join set of tuples within list.

for example,

[(1, 2, 3), (1, 2, 4), (1, 2, 5)] 

would become

[123, 124, 125] (or ['123', '124', '125'] if must become string) 

i have no idea how this, , searching returns little of use.

how go this?

>>> bs = [(1, 2, 3), (1, 2, 4), (1, 2, 5)] >>> ["".join(map(str, b)) b in bs] ['123', '124', '125'] 

use int() convert if result must numbers


Comments

Popular posts from this blog

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -