<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
>
<channel>
<title>Вы искали глобальное потепление | New-Science.ru</title>
<atom:link href="https://new-science.ru/search/%D0%B3%D0%BB%D0%BE%D0%B1%D0%B0%D0%BB%D1%8C%D0%BD%D0%BE%D0%B5+%D0%BF%D0%BE%D1%82%D0%B5%D0%BF%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5/feed/rss2/" rel="self" type="applica
tion/rss+xml" />
<link>https://new-science.ru</link>
<description>Актуальные новости научных открытий, высоких технологий, электроники и космоса.</description>
<lastBuildDate>Sat, 05 Apr 2025 17:04:46 +0000</lastBuildDate>
<language>ru-RU</language>
<sy:updatePeriod>
hourly </sy:updatePeriod>
<sy:updateFrequency>
1 </sy:updateFrequency>
<generator>https://wordpress.org/?v=6.7.2</generator>
<image>
<url>https://new-science.ru/wp-content/uploads/2019/08/favicon.png</url>
<title>Вы искали глобальное потепление | New-Science.ru</title>
<link>https://new-science.ru</link>
<width>32</width>
<height>32</height>
</image>
...
<item>
<title>Атмосферные реки мигрируют к полюсам, изменяя климат планеты</title>
<link>https://new-science.ru/atmosfernye-reki-migrirujut-k-poljusam-izmenyaya-klimat-planety/</link>
<dc:creator><![CDATA[New-Science.ru]]></dc:creator>
<pubDate>Wed, 27 Nov 2024 07:20:47 +0000</pubDate>
<category><![CDATA[Природа]]></category>
<guid isPermaLink="false">https://new-science.ru/?p=47504</guid>
<description><![CDATA[<img width="1200" height="525" src="https://new-science.ru/wp-content/uploads/2024/11/865-6.jpg" class="webfeedsFeaturedVisual wp-post-image" alt="" st
yle="display: block; margin-bottom: 5px; clear:both;max-width: 100%;" link_thumbnail="" decoding="async" loading="lazy" srcset="https://new-science.ru/wp-content/uploads/2024/11/865-6.jpg 1200w, https://new-scienc
e.ru/wp-content/uploads/2024/11/865-6-768x336.jpg 768w" sizes="auto, (max-width: 1200px) 100vw, 1200px" />Атмосферные реки, мощные потоки водяного пара, взвешенного в атмосфере, уже несколько десятилетий движутся
неожиданным образом, изменяя характер осадков и климат в глобальном масштабе. Что такое атмосферная река? Атмосферные реки — это огромные потоки водяного пара, которые циркулируют в атмосфере и переносят количеств
о влаги, сравнимое с крупнейшими реками на Земле, такими как Миссисипи. Эти небесные реки …]]></description>
</item>
</channel>
</rss>
с одинаковыми idкорень проблемы, начни с понимания что такое id, как поймешь, избавься от этого корня. Подсказка, селекторы могут не только по id быть, можно по class, data-атрибутам, да даже по расположению тегов.
# допустим, это наш код
try:
file = open("config.json", "r") # исключение может произойти тут
config = json.load(file) # или тут
print(config)
except FileNotFoundError:
print(">>> Файл не найден!")
except PermissionError:
print(">>> Доступ запрещен!")
finally:
print(">>> Файл закрылся!")
file.close()
D = dict()
NOTFOUND = object()
def f1(x):
result = D.get(x, NOTFOUND)
if result is NOTFOUND:
result = D[x] = long_calculation()
return result
import time
from math import tan, atan
import timeit
NOTFOUND = object()
def long_calculation(x):
return atan(tan(x) / 2)
def f1(x):
if x not in D:
D[x] = long_calculation(x)
return D[x]
def f2(x):
try:
return D[x]
except:
D[x] = long_calculation(x)
return D[x]
def f3(x):
result = D.get(x, NOTFOUND)
if result is NOTFOUND:
result = D[x] = long_calculation(x)
return result
FUNCS = (
(f1, 'get triple'),
(f2, 'except'),
(f3, 'get once'),
)
def work(f, gap=0.1, count=1000):
for x in range(0, count):
f(x + gap)
D = {}
number = 10000
for func, descr in FUNCS:
print(f'{func.__name__} ({descr}):')
print(f' Cache empty:', timeit.timeit(f"work({func.__name__})", setup=f'D=dict()', globals=globals(), number=number))
print(f' Total reuse:', timeit.timeit(f"work({func.__name__})", setup=f'D=dict(); work({func.__name__})', globals=globals(), number=number))
print(f' Total miss :', timeit.timeit(f"work({func.__name__})", setup=f'D=dict(); work({func.__name__}, gap=0.2)', globals=globals(), number=number))
f1 (get triple):
Cache empty: 2.8940897800493985
Total reuse: 1.7486431139986962
Total miss : 1.6964515489526093
f2 (except):
Cache empty: 1.2670072519686073
Total reuse: 1.2622331579914317
Total miss : 1.2547212480567396
f3 (get once):
Cache empty: 1.6983374420087785
Total reuse: 1.6465996010228992
Total miss : 1.6999219709541649
Easier to ask for forgiveness than permission. This common Python coding style assumes the existence of valid keys or attributes and catches exceptions if the assumption proves false. This clean and fast style is characterized by the presence of many try and except statements. The technique contrasts with the LBYL style common to many other languages such as C.