Tag Archives: TypeError: ‘tuple‘ object is not callable

Type error: ‘tuple’ object is not callable and one of the solutions

I’ve been learning something new recently. I’ve been tortured by all kinds of pits

Background:

I learned from the code in the book, which was written in Python 2.7, while I wrote in Python 3.6

For this error report, it is also divided into grammatical differences. Because in python2.7, it can be executed and no error is reported

Error code:

Error content:

Is such a report error, a variety of Baidu solutions, in fact, did not find a reliable, or finally pieced together to solve it

It’s very simple

The solved code should be:

At first glance, there is no change. In fact, it is not the case. Among them, “strong> () ” is changed to “ [] “, and then it is miraculously normal. This error may also be due to other reasons, which is the case here. For reference only. OK, that’s it

TypeError: ‘tuple‘ object is not callable

Use square brackets instead of parentheses when indexing tuples

undertake MATLAB, Python and C + + programming, machine learning, computer vision theory implementation and guidance, undergraduate and master can, salted fish trading, professional answer please go to know, for details, please contact QQ number 757160542, if you are the one

This article shares in the blog “Yu Xiaoyong” (CSDN).