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

Similar Posts: