Error guide · AttributeError
AttributeError: 'str' object has no attribute 'append'
You used a list method on text.
Example
word = "cat" word.append("s")
What Python says
AttributeError: 'str' object has no attribute 'append'
As printed by Python 3.12. Other versions may word it slightly differently.
Why it happens
append belongs to lists. Strings cannot be changed in place, so they have no such method. To add text, build a new string with +. The error message always names the type of the value and the missing method, which tells you what to look up.
How to fix it
word = "cat" word = word + "s" print(word)
Output: cats
Tips
- Join text with
+or an f-string:word = f"{word}s". - To change letters one by one, turn the text into a list with
list(word)and join it back with"".join(...). - Check the type with
type(word)when a method is reported as missing.