I have a list which should contain string with a particular format or character i.e. {{str(x), str(y)},{str(x), str(y)}}. I tried to do string concat like: "{{"+str(x), str(y)+"},{"+str(x), str(y)+"}}" and append to list, but it gets surrounded by brackets: [({{str(x), str(y)}),({str(x), str(y)}})]
How can I get rid of the brackets or betterstill, is there a better approach to having a list without brackets like this: [{{string, string},{string, string}}]
-
Those braces; you heard about sets?Moses Koledoye– Moses Koledoye2016年09月20日 14:39:08 +00:00Commented Sep 20, 2016 at 14:39
1 Answer 1
The parentheses are because you're creating a tuple of three items:
"{{"+str(x)str(y)+"},{"+str(x)str(y)+"}}"
Try replacing those bare commas between str(x) and str(y) with +","+:
"{{"+str(x)+","+str(y)+"},{"+str(x)+","str(y)+"}}"