E
E
etogavrusha2020-06-19 21:23:27
Python
etogavrusha, 2020-06-19 21:23:27

What to do if you can not turn to the dictionary?

Here is an excerpt from the code:

newchat = vk.messages.getHistory(peer_id=2000000076)
print(newchat.get('text'))

After GetHistory I get a dictionary from which I want to pull out 'text' (the last message), but I get the default value "None", instead of the desired "Hello"
What did I do wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Pankov, 2020-06-19
@etogavrusha

Do print(newchat)it and you will immediately see what is wrong.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question