Мои приветствия.
——————–
Задание:
Read config.json file located in :
/data/python/config.json
make a GET request to the URL under ‘url’ key and add the first 15 characters
to a key name ‘content’ in the json file.
config.json:
{“url”: "https://www.google.com“}
config.json after code run:
{”url“: ”https://www.google.com“, ”content“: ”<first15>“}
Where <first15> should be the first 15 characters from the response.
——————–
Написан код:
import json
import requests
with open(”/home/Exam/Python/data/python/config.json“, ”r“) as f:
#with open(”home/Exam/Python/config.json“, ”r") as f:
config = json.load(f)
result = requests.get(config)
config = result.text
with open(“/home/Exam/Python/data/python/config.json”, “w”) as f:
json.dump(config, f)
——————–
Но не совсем понятно что должно измениться после изменения conf.json файла….
И Where <first15> should be the first 15 characters from the response.
Буду рад пояснению