Python - convert list of tuples to string -


Which is the most dragon way of converting a list of tuples to string?

I have:

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

And I want to:

  "(1, 2), (3,4)"  

The solution is mine:

  l = [ L = s (=% s,% s), "% ts = s [: - 1]  
P> Is there a more insignificant way to do this?

You want to do something like:

  & gt; & Gt; & Gt; L = [(1,2), (3,4)]> gt; & Gt; & Gt; Straw (L). Strip ('[]') '(1, 2), (3, 4)'  

.. which is easy but guaranteed to work correctly Not


Comments