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

Резултати

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

Пребарај: #explosion

当前筛选 #explosion清除筛选
Addis Standard

@addisstandardeng · Post #21395 · 13.02.2026 г., 12:29

#Explosion reported in #Mekelle; Officials say no casualties An explosion occurred late Thursday in Mekelle near the Social Science campus of Mekelle University, though officials say there were no casualties or property damage. Redahegn Feseha, head of the Mekelle Peace and Security Bureau, told local radio that the blast happened at around 9:30 p.m. near the upper gate of the city’s business campus. He described the incident as a deliberate act aimed at creating fear rather than causing harm, urging residents to remain calm and to condemn what he called an “act of terror.” Residents reported a mix of fear and confusion. “I was sitting with my family when we heard a loud bang. My kid and my wife were terrified,” said one resident. Another added, “At first, we thought it was a drone attack or something falling. But later we heard it was a bomb.” https://www.facebook.com/share/p/19x2dWByCq/

MALI 24

@kamissokosekou3 · Post #37588 · 04.05.2026 г., 22:22

🇨🇳 Une explosion s’est produite dans une usine de feux d’artifice en Chine, faisant 3 morts et 25 blessés, a rapporté l’agence Xinhua. Vidéo: My Fair Lady/X #chine#usine#explosion

Voir de ses propres yeux

@voir_yeux · Post #12282 · 27.03.2026 г., 09:27

🇮🇷🇮🇱🇺🇸 Plusieurs civils ont été tués dans l’explosion de mines dissimulées dans des boîtes de conserve, larguées par des avions américains et israéliens près de la ville de Chiraz, dans le sud de l’Iran, rapporte l’agence Tasnim. #iran#explosion#bilan

Voir de ses propres yeux

@voir_yeux · Post #12718 · 28.04.2026 г., 22:43

🇬🇧 En Irlande du Nord, un homme a été arrêté après l'explosion d'une voiture devant un commissariat de police. Des perquisitions sont en cours à plusieurs adresses de Belfast, indique un communiqué de la police régionale. #royaumeuni#voiture#explosion

Voir de ses propres yeux

@voir_yeux · Post #12765 · 01.05.2026 г., 20:54

🇬🇧 Un obus non explosé de la Seconde Guerre mondiale a été neutralisé par une explosion contrôlée dans la ville de Plymouth, dans le sud-ouest de l'Angleterre. La BBC a diffusé une vidéo de l'explosion. La bombe aérienne allemande SC250, une bombe à explosion pesant environ un quart de tonne, a été découverte le 30 avril par un propriétaire qui creusait une tranchée sur son terrain dans le quartier de Southway. La zone a été bouclée et les habitants de près de 1.200 maisons avoisinantes ont dû évacuer leurs domiciles. #royaumeuni#explosion#obus

ПретходнаСтраница 1 од 3Следна