0
Why str attribute error object has no attribute
I try to access method using dot " a = "Abdulrahman " print(a.len()) " instead of passing the variable as parameter of len() "print(len(a))" https://code.sololearn.com/cDgvlHi3AL6y/?ref=app
2 Antworten
+ 4
There is no .len() method on the `str` type. There is a .__len__() method which you can use, but you should stick to the usual approach of using the len(str_param) function to get the length
+ 2
I think the reason is that there is actually no reason for len to be an attribute as it does not need any more parameters except the string or value itself