M
M
mirindanda2021-12-10 14:36:30
Python
mirindanda, 2021-12-10 14:36:30

How to get the url?

{
"date": "2021-12-07",
"explanation": "very time two massive black holes collide, a loud chirping sound is broadcast out into the universe in gravitational waves. Humanity has only had the technology to hear these unusual chirps for the past seven years, but since then we have heard about 90 -- during the first three observing runs. Featured above are the spectrograms -- plots of gravitational-wave frequency versus time -- of these 90 as detected by the giant detectors of LIGO (in the USA), VIRGO (in Europe) , and KAGRA (in Japan).The more energy received on Earth from a collision, the brighter it appears on the graphic. a new way to measure the expansion rate of our universe.A fourth gravitational wave observing run with increased sensitivity is currently planned to begin in 2022 December.",
"hdurl": " https://apod.nasa.gov/apod/image/2112/GWaveCatalog... ",
"media_type": "image",
"service_version": "v1",
"title": "Ninety Gravitational Wave Spectrograms and Counting",
"url": " https://apod.nasa.gov/apod/image/2112/GWaveCatalog... "
}

I have this json file and I need to get the link from the url

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Leonid, 2021-12-11
@mirindanda

import json

# если читаем из файлового объекта data.json
with open("data.json") as ff:
    data1 = json.load(ff)

print(data1["url"])

# если получили данные как строка в переменную data_string
data2 = json.loads(data_string)

print(data2["url"])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question