AttributeError: 'str' object has no attribute 'sum'
时间: 2023-10-23 18:11:15 浏览: 179
Python3下错误AttributeError: ‘dict’ object has no attribute’iteritems‘的分析与解决
5星 · 资源好评率100%
This error message is raised when you try to call the `sum()` method on a string object, but strings do not have a `sum()` method.
For example, if you have a string variable `my_string` and you try to call `my_string.sum()`, you will get this error message.
To fix this error, you need to ensure that you are calling the `sum()` method on an iterable object like a list, tuple or set which supports this method.
阅读全文