JustCaptain kod-buduschego
1b7ae631e8e0aa08482b2abc32064a70d25c5de5
Перейти к файлу
Код
kod-buduschego Python 2025-20264.2. Веб-скрапингpracticestask_1.py
anc update c70a58f 8 октября 2026 г.
task_1.py
import requests

url: str = "https://new-science.ru/category/news/page/2/"
response = requests.get(url)
print(
    "Длина текста {}\nПервые 500 символов:\n{}".format(
        len(response.text), response.text[:500]
    )
)

with open("site.html", mode="w", encoding="utf-8") as file:
    file.write(response.text)