", ".join(["{0} ({1})".format(x[0], x[1]) for x in a])
a - .
. for x in a , x , , :
a = [1, 2, 3]
b = [x for x in a]
print(b)
. . [0] [1], . format :
a = Thimble
b = 1.234
print("{0} ({1})".format(a, b)
Thimble (1.234), {0} {1} get , , :
a = [ ('StemCells', 16.530000000000001),
('Bcells', 13.59),
('Monocytes', 11.58),
('abTcells', 10.050000000000001) ]
b = ["{0} ({1})".format(x[0], x[1]) for x in a]
print(b)
:
['StemCells (16.53)', 'Bcells (13.59)', 'Monocytes (11.58)', 'abTcells (10.05)']
, , join, :
", ".join(b)
, , , ',' :
StemCells (16.53), Bcells (13.59), Monocytes (11.58), abTcells (10.05)
, Python 3.3, , Python 2.7 , , .