Fixed TypeError: object of type 'int' has no len()
Article Directory
Error report
I have encountered this pit in my work before, and record the problem and solution. It may not be applicable to all situations, but it can be used for your reference.
The problem description is as follows:
TypeError: object of type ‘int‘ has no len()
TypeError: object of type 'int' has no len()
Solution
Change
plt.xticks(3, ['111','222','333'])
to
plt.xticks([1,2,3], ['111','222','333'])
PS
If you have any questions, just leave a message in the comment area