L
L
l33xx2020-04-29 13:57:44
Python
l33xx, 2020-04-29 13:57:44

How to parse this JSON page?

I need to parse line strings
But for some reason it doesn't work for me
Please help
5ea95d767a549568852829.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Pankov, 2020-04-29
@trapwalker

Well, read carefully:

print(json['result']['line'])
TypeError: list indices must be integers or slices, not str

json['result'] is not a dictionary, but a list, and you can access it only by an integer index.
print([item['line'] for item in json['result']])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question