B
B
boda10062021-09-16 17:39:45
Python
boda1006, 2021-09-16 17:39:45

How to remove an element from a python dictionary?

there is such a code and it works, but I can delete the element as I understand it from the dictionary and the code works infinity can you tell me how to solve this problem
(this is the SimpleQiwi library)

api = QApi(phone=phone, token=token)

payments = api.payments['data']

amount = 1
@bot.message_handler(content_types=['text'])
def text(message):
    if message.text == "pay":
        bot.send_message(message.chat.id,message.chat.id)
    if message.text == "chek":
        for info_payments in payments:

            if info_payments['comment'] == "444":  # str(message.chat.id):

                print("da")
                print(info_payments['sum']['amount'])
                bot.send_message(message.chat.id, "вы отправили: " + str(info_payments['sum']['amount']))
                del info_payments['comment']


bot.polling()

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
low molecular macro, 2021-09-16
@molekulyarniy

bots again!

P
Python Newbie, 2021-09-16
@Levman5

Read

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question