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

Резултати

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

Пребарај: #goodness

当前筛选 #goodness清除筛选
EKOLOG.UZ| ENG

@ekologuzenglish · Post #10069 · 24.10.2025 г., 12:02

🐾🔥 The Story of Scarlett — The Mother Cat Who Rushed Into Fire to Save Her Babies 💔🐱 Sometimes, true heroism doesn’t come from people, but from those who love unconditionally. 💖 This is how the world learned about Scarlett, a brave cat who, back in 1996, did something incredible — she ran five times into a burning garage to save her kittens. 🏚 It happened in one of the old garages in Brooklyn, New York, where Scarlett lived quietly with her kittens. But on the night of March 30, someone set the building on fire. Flames spread instantly, filling the place with smoke and unbearable heat. When the firefighters 🚒 arrived, they were stunned: they saw a cat running into the fire again and again, disappearing in the flames and coming out each time with a kitten in her mouth 🐈‍⬛🐈🐈‍⬛🐈🐈‍⬛ She carefully placed each baby in a safe spot, and despite the pain and fear, she rushed back into the fire to rescue the next one. 🔥 Each time she came out, she was weaker. Her fur was scorched, her ears and whiskers were burned, her paws were raw and blistered, and her eyes clouded from the heat… 😿 But she could only carry one kitten at a time, so she had no choice but to keep going. When the last, fifth kitten was finally safe, the now-blind Scarlett touched each baby with her nose, making sure all were alive ❤️ Only then did she collapse, unconscious… Deeply moved by her bravery, the firefighters rushed her and the kittens to a veterinary clinic 🏥 There, the vets treated and nursed them back to health. The story quickly made it into the New York Post 📰 — and it touched hearts all around the world. People sent letters, donations, and offers to adopt the little feline family. 😺 The kittens were soon adopted into loving homes. As for Scarlett, after recovering, she was adopted by a kind woman named Karen Wellen ❤️ In an interview, Karen said: “I will care for her as if she were my own child.” And she kept her promise 🙏 Scarlett lived 13 more happy years with Karen, never again knowing fear, pain, or hunger. Sometimes she would tremble in her sleep — as if remembering the fire — but she was always surrounded by love and safety. 🌷 🐾 Scarlett’s story became a symbol of motherly love, devotion, and courage. The media called her “Cat of the Century”, and millions of people around the world saw in her a reminder that even the smallest heart is capable of the greatest heroism 💫 💚 Let this story remind us all: Love is the power that can conquer even fire. 🔥 👇 ☘️ Read more inspiring stories and ecological news on @ekologuz 💌 Share your stories and suggestions through @eklguz_bot #ecology#animals#goodness#hero#ScarlettTheCat#ecologuz#animalheroes#love#motherhero🐾💚

Семеновский vs. Semenovskiy

@igor_semenovskiy · Post #3333 · 29.08.2025 г., 15:36

Вот и лето прошло, Словно и не бывало. На пригреве тепло. Только этого мало. . Всё, что сбыться могло, Мне, как лист пятипалый, Прямо в руки легло. Только этого мало. . Понапрасну ни зло, Ни добро не пропало, Всё горело светло. Только этого мало. . Жизнь брала под крыло, Берегла и спасала. Мне и вправду везло. Только этого мало. . Листьев не обожгло, Веток не обломало... День промыт, как стекло. Только этого мало. . Арсений Тарковский, 1967 г. . #лето#тепло#солнце#поэзия#стихи#творчество#искусство#добро#друзья#люьовь#прогулки#Москва#Зарядье#будущее#осень #summer#warm#sun#poetry#creativity#art#goodness#friends#love#walks#Moscow#Zaryadye#future#autumn