Python AttributeError: meaning and fix

AttributeError: You called a feature that this value does not have.

Code that causes it

items = [1]
items.add(2)
Open in the runner

You used a feature name from a different type. The name is misspelled. The value was None.

Look at what a value offers with dir() or help(). Check its type with type().

How to fix it

items = [1]
items.append(2)
print(items)
Open in the runner

Why it happens

The name after the dot must be something that value has. A list has append, but it has no add.

The official docs are in English. See it in the official Python docs

Back to the runnerMore errors