K
K
Kamil2K2020-06-22 13:31:20
Python
Kamil2K, 2020-06-22 13:31:20

Error in Python, what to do?

An error:

AttributeError: 'dict' object has no attribute 'remove'

Related to this code:
def delete_product(user_group, shop = shop, **products):
    if user_group in shop:
        shop[user_group].remove(products)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2020-06-22
@Kamil2K

Dictionaries have no such method. Use one of the following options:

dict.pop()
del dict[key]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question