I have a list of tuples like:
data = [(\'a1\', \'a2\'), (\'b1\', \'b2\')]
And I want to generate a string like this: \"(\'a1\', \'a2\
\"(\'a1\', \'a2\
Discard the opening and closing brackets from str() output:
str()
>>> data = [('a1', 'a2'), ('b1', 'b2')] >>> str(data) "[('a1', 'a2'), ('b1', 'b2')]" >>> str(data)[1:-1] "('a1', 'a2'), ('b1', 'b2')" >>>