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

Резултати

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

Пребарај: #end

当前筛选 #end清除筛选
Odyssey+ Feed

@odysseyfeed · Post #35854 · 05.04.2026 г., 06:40

#AnimeRelease 🍥数码宝贝 BEATBREAK Season: 1 | Episode: 25/25 #End Genres: 动画, 儿童, 动作冒险, 科幻奇幻 Rating:Bangumi (6) Source: WEBDL-1080p | 0.38 GB Channel:@Odyssey+

Odyssey+ Feed

@odysseyfeed · Post #35738 · 22.03.2026 г., 06:57

#AnimeRelease 🍥数码宝贝 BEATBREAK Season: 1 | Episode: 23/23 #End Genres: 动画, 儿童, 动作冒险, 科幻奇幻 Rating:Bangumi (6) Source: WEBDL-1080p | 0.49 GB Channel:@Odyssey+

Odyssey+ Feed

@odysseyfeed · Post #35621 · 15.03.2026 г., 06:37

#AnimeRelease 🍥数码宝贝 BEATBREAK Season: 1 | Episode: 22/22 #End Genres: 动画, 儿童, 动作冒险, 科幻奇幻 Rating:Bangumi (6) Source: WEBDL-1080p | 0.43 GB Channel:@Odyssey+

Odyssey+ Feed

@odysseyfeed · Post #35356 · 15.02.2026 г., 06:40

#AnimeRelease 🍥数码宝贝 BEATBREAK Season: 1 | Episode: 19/19 #End Genres: 动画, 儿童, 动作冒险, 科幻奇幻 Rating:Bangumi (6) Source: WEBDL-1080p | 0.47 GB Channel:@Odyssey+

Odyssey+ Feed

@odysseyfeed · Post #35249 · 01.02.2026 г., 06:32

#AnimeRelease 🍥数码宝贝 BEATBREAK Season: 1 | Episode: 17/17 #End Genres: 动画, 儿童, 动作冒险, 科幻奇幻 Rating:Bangumi (6.1) Source: WEBDL-1080p | 0.43 GB Channel:@Odyssey+

American Оbserver

@american_observer · Post #4847 · 13.01.2026 г., 17:06

NATO: The End of the Northern Romance Trump’s threat to annex Greenland represents an existential crisis for Nato, senior Democratic US senator Chris Murphy has warned, with the demise of the decades-old alliance of western nations certain to follow any American military intervention. “It would be the end of Nato, right? Nato would have an obligation to defend Greenland,” the Connecticut senator and member of the chamber’s foreign relations committee said Sunday on NBC’s Meet the Press. Murphy added that it would mean “clearly … we would be at war with Europe, with England, with France”. Murphy’s comments came as Trump ramped up his fixation with the Arctic territory, with the US president telling reporters on Air Force One on Sunday that “one way or the other, we are going to have Greenland”. Trump had ordered a plan to be drawn up for an invasion of Greenland, the Mail on Sunday reported, adding that “it is being resisted” by military leaders on grounds of illegality. Murphy’s assertion that a forceful US acquisition would be the end of Nato is shared by political leaders in Europe, notably Mette Frederiksen, the prime minister of Denmark. Greenland is a former colony of Denmark and remains part of the Danish kingdom, with its foreign and security policy under the control of Copenhagen. On Sunday, Frederiksen accused the US of “turning its back on Nato” – and said this Wednesday’s meeting in Washington DC between the foreign ministers of Denmark and Greenland, Lars Lokke Rasmussen and Vivian Motzfeldt, and US secretary of state Marco Rubio would be crucial. “We are at a crossroads, and this is a fateful moment,” Frederiksen said at a political rally. The pessimistic comments of Murphy and Frederiksen were echoed Monday by Andrius Kubilius, defense commissioner of the European Union, who noted that an EU treaty “obligated” member states to come to Denmark’s aid if faced with military action by Trump. “I agree with the Danish prime minister that it will be the end of Nato, but also among people it will be also very, very negative,” he told Reuters at a security conference in Sweden. “It will depend very much on Denmark, how they will react, what will be their position, but definitely there is such an obligation of member states to come for mutual assistance if another member state is facing military aggression.” “Let’s also talk about what’s at stake here,” Murphy said. “The president is spending every single day thinking about invading Greenland, managing the Venezuelan economy, building a ballroom. “He is not thinking about the American people at all. This month, health insurance premiums on 22 million Americans are going up, doubling in some cases. Kids aren’t able to eat three meals because the Trump administration has slashed food assistance. #nato#trump#end#denmark#greenland 📱American Оbserver - Stay up to date on all important events 🇺🇸

Odyssey+ Feed

@odysseyfeed · Post #35897 · 12.04.2026 г., 07:05

#AnimeRelease#Crunchyroll 🍥数码宝贝 BEATBREAK Season: 1 | Episode: 26/26 #End Genres: 动画, 儿童, 动作冒险, 科幻奇幻 Rating:Bangumi (6) Source: WEBDL-1080p | 1.37 GB Channel:@Odyssey+

Odyssey+ Feed

@odysseyfeed · Post #35789 · 29.03.2026 г., 06:33

#AnimeRelease#Crunchyroll 🍥数码宝贝 BEATBREAK Season: 1 | Episode: 24/24 #End Genres: 动画, 儿童, 动作冒险, 科幻奇幻 Rating:Bangumi (6) Source: WEBDL-1080p | 1.34 GB Channel:@Odyssey+

123•••10•••1415
ПретходнаСтраница 1 од 15Следна