python - Turning tuples into a pairwise string -


i have following tuples

[   ('stemcells', 16.530000000000001),     ('bcells', 13.59),     ('monocytes', 11.58),     ('abtcells', 10.050000000000001),     ('macrophages', 9.6899999999999995),     ('gdtcells', 9.4900000000000002),     ('stromalcells', 9.3599999999999994),     ('dendriticcells', 9.1999999999999993),     ('nkcells', 7.8099999999999996),     ('neutrophils', 2.71)] 

what want create create single string looks this:

stemcells(16.53), bcells(13.59), monocytes(11.58) .... neutrophils(2.71) 

how can conveniently in python?

', '.join('%s(%.02f)' % (x, y) x, y in tuplelist) 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -