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

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -