Tuple conversion to a string

Posted by David542 on Stack Overflow See other posts from Stack Overflow or by David542
Published on 2012-09-18T21:22:25Z Indexed on 2012/09/18 21:38 UTC
Read the original article Hit count: 346

Filed under:

I have the following list:

[('Steve Buscemi', 'Mr. Pink'), ('Chris Penn', 'Nice Guy Eddie'), ...]

I need to convert it to a string in the following format:

"(Steve Buscemi, Mr. Pink), (Chris Penn, Nice Guy Eddit), ..."

I tried doing

str = ', '.join(item for item in items)

but run into the following error:

TypeError: sequence item 0: expected string, tuple found

How would I do the above formatting?

© Stack Overflow or respective owner

Related posts about python