TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #309 · 2 фев.

Метод строки split() разделяет строку на несколько строк по указанному символу >>> "a_b_c".split('_') ['a', 'b', 'c'] Можно указать максимальное количество разделений >>> "a_b_c".split('_', 1) ['a', 'b_c'] Или резать с другой стороны с помощью rsplit() (right split) >>> "a_b_c".rsplit('_', 1) ['a_b', 'c'] А что будет если оставить аргументы пустыми? >>> "a_b_c".split() ['a_b_c'] Получаем список с одним элементом, потому что по умолчанию используется пробельный символ. >>> "a b c".split() ['a', 'b', 'c'] То есть это равнозначно такому вызову? >>> "a b c".split(" ") ['a', 'b', 'c'] Кажется да, но нет! Давайте попробуем добавить пробелов между буквами >>> "a b c".split(" ") ['a', '', '', 'b', '', '', 'c'] И вот картина уже не так предсказуема 😕 А вот что будет по умолчанию >>> "a b c".split() ['a', 'b', 'c'] Всё снова красиво! 🤩 По умолчанию в качестве разделителя используется любой пробельный символ, будь то табуляция или новая строка. Включая несколько таких символов идущих подряд. А также игнорируются пробельные символы по краям строки. >>> "a\t b\n c ".split() ['a', 'b', 'c'] Аналогичный способ можно собрать с помощью регулярного выражения. Но пробелы по краям строки придется обрабатывать дополнительно. >>> import re >>> re.split(r"\s+", ' a b c '.strip()) ['a', 'b', 'c'] Здесь тоже можно указать количество разделений >>> re.split(r"\s+", 'a b c', 1) ['a', 'b c'] А что если мы хотим написать красиво, то есть split() без аргументов, но при этом указать количество разделений? В этом случае первым аргументом передаём None >>> "a\n b c".split(None, 1) ['a', 'b c'] Данный метод не учитывает строки с пробелами, взятые в кавычки 'a "b c" '.split() ['a', '"b', 'c"'] Но для таких случаев есть другие способы. #tricks#basic

Резултати

Пронајдени 3 слични објави

Пребарај: #conditions

当前筛选 #conditions清除筛选
MDC Uzbekistan

@mdcuzbekistan · Post #16 · 18.05.2021 г., 17:38

IF-ELSE C# dasturlash tilida if-else lar bilan tanishamiz (Men tanishman siz tanishasiz) Biz hayotda juda ko’p if va else ni ishlatganmiz. “IF” so’zi o’zbek tiliga “Agar” deb tarjima qilinadi. Keling avval ifni o’zini o’rganib olaylik : Misol: “Agar bir qop pulim bo’lsa, albatta ularni hammasini yoqib yuborgan bo’lar edim”. 👉Batafsil 👨‍🏫 Mentor: Sobirjonov O'tkirbek #csharp#if#else#conditions#starter#dotnet .NET Uzbekistan Community __________ Telegram | Instagram | Youtube

American Оbserver

@american_observer · Post #5567 · 05.04.2026 г., 02:04

🔤🔤🔤🔤➖ Over the last few days, high water temperatures have cooled somewhat, raising the prospect that the heatwave may be dissipating already. It will take more time, however, to know for sure that the heat is clearing. “The expectation right now is that likely the waters down to even southern California should start cooling a little bit into next month, but it’s not a guaranteed thing,” Leising said. “The concern is the sequence of events and how they unfold.” Prolonged ocean heat has a devastating impact on phytoplankton and can cause harmful algal blooms. Those changes can wreak havoc on many forms of marine life, from sea lions and dolphins, to shore birds and halibut. The Blob years led to one of the worst Dungeness crab seasons in recent history, said Melissa Carter, a researcher at the UC-San Diego Scripps Institution of Oceanography. Such heatwaves are becoming more common and lasting longer, partly because of the slow warming of the oceans driven by the climate crisis, and partly because of atmospheric changes that scientists are still struggling to understand. “The question is what’s causing us to have these extreme warm temperatures?” Carter said. “What are the drivers? That’s what we’re trying to find out.” What concerns Carter is that once these high-pressure systems establish themselves in an area, they create a “feedback loop” that tends to reinforce warm, calm conditions, making upwelling less likely to occur, she said. “If these systems do become that strong and persistent, where they come every year, it can have the potential to shut down upwelling,” Carter said. “Everything we think of related to the health of the ecosystems of the west coast could be forever altered.” The lingering ocean heat offers a few upsides, though they pale in comparison with the costs. The warmer water temperatures bring tuna far closer to shore, making it easier to fish for them. Surfers and swimmers have also enjoyed warmer water through the winter. “I enjoy being in the water when it’s a marine heatwave,” Carter said. “But our ocean should not be a swimming pool. Nothing can live in a swimming pool. That’s not what we want.” #highpressure#conditions#marine#life#ocean 📱American Оbserver - Stay up to date on all important events 🇺🇸

American Оbserver

@american_observer · Post #5566 · 05.04.2026 г., 01:02

Researchers Warn the High-Pressure Conditions Could Disrupt Marine Life 🔤🔤🔤🔤1️⃣ For more than a century, shoreline stations operated by the Scripps Institution of Oceanography have measured water temperatures along the California coast. This year, they are flashing a warning sign. Over the last three months, several stations have repeatedly posted record-breaking daily high temperatures – with the La Jolla station registering temperatures a full 10F above historical average at one point last month. The waters of southern California historically warm every few years as tropical currents make their way north, a phenomenon known as El Niño. But the marine heatwave that started last fall wasn’t caused by tropical currents. Instead, a high-pressure atmospheric system – think of calm, sunny days – has perched above southern California, warming both air and sea above historic levels. The same phenomenon has helped fuel a ferocious California heatwave on land. Testing the waters: can pumping chemicals into the ocean help stop global heating? The extended ocean warming has drawn comparisons to “the Blob”, a three-year marine heatwave caused by similar prolonged high-pressure conditions a decade ago that devastated marine life. The next few weeks are likely to determine whether this marine heatwave fizzles out or evolves into something more Blob-like, scientists say. “The biggest concern is how the year plays out,” Andrew Leising, an oceanographer with the National Oceanic and Atmospheric Administration, said. “We could be looking at much larger impacts next fall and winter, if it stays warm and then it’s followed by a strong El Niño.” It’s typical in the spring for shifting atmospheric conditions to generate north-westerly winds that push warm surface water back out to the open ocean, allowing cooler water from below to rise to the surface–a phenomenon called upwelling. Upwelling brings nutrient-rich water from the depths to the surface, feeding the phytoplankton that play a crucial role in supporting much of California’s marine life. #highpressure#conditions#marine#life#ocean 📱American Оbserver - Stay up to date on all important events 🇺🇸