JustCaptain kod-buduschego
e44b3dcaea03c3c3b4fbebcb5af2325d40ae8b10
Перейти к файлу
Код
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)