如何从列表中删除方括号?

I want to change [{('X', 2)}] into {('X',2)}. Does anyone knows how to do this?

我试过了:

c = [{('X', 2)}]
res = str(c)[1:-1]

但这不起作用,因为它给出了一个字符串。

评论