![](/img/trans.png)
[英]Why am I getting "'tuple' object is not callable error in python
[英]I am getting 'tuple' object is not callable as an error
brackets = set([(()())])
Stack = []
StackSize = 20
ch=(['(',')'])
arr=[]
在這里,我生成了一組顯示錯誤的括號。 如何糾正?
實際上,表達式內的tuple
是使用另一個元組表達式()
調用的
>>> ()()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'tuple' object is not callable
>>>
我認為您想創建一個類似於以下作為字符串值的字符串。 例如:
>>> brackets = set('[','(','()','()',')',']')
它應該是
brackets = set('[','(','(',')','(',')',')',']')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.