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 слични објави

Пребарај: #romantasy

当前筛选 #romantasy清除筛选
Velvet Pages | eLibrary 🥂

@bookslibraryofficial · Post #1268 · 18.05.2025 г., 16:31

📖Title : Fearless ✍️Author : Lauren Roberts ⭐️Rating : 4.22/5 (Goodreads) 📆Published : Apr 08, 2025 ———————————————— Summary:Fearless by Lauren Roberts is the gripping conclusion to The Powerless Trilogy, a young adult romantasy series. The story follows Paedyn Gray, an Ordinary in a world dominated by the powerful Elites, as she returns to the Kingdom of Ilya. Facing a life-altering decision, Paedyn must navigate political intrigue, personal betrayals, and the complexities of love. Her relationship with Kai Azer, an Elite and her former adversary, intensifies amidst the kingdom's turmoil. As Paedyn confronts trials that test her courage and resilience, she challenges societal norms and redefines strength. Roberts weaves a tale of empowerment, loyalty, and the enduring power of love in a fractured world. ———————————————— #fiction#fantasy#romantasy#youngadult@Bookslibraryofficial@free_novellas@the_ancient_library

Velvet Pages | eLibrary 🥂

@bookslibraryofficial · Post #1264 · 18.05.2025 г., 06:46

📖Title : Enigma ✍️Author : RuNyx ⭐️Rating : 3.91/5 (Goodreads) 📆Published : Apr 29, 2025 ———————————————— Summary:Enigma by RuNyx is a steamy dark academia romance that follows Salem Salazar, the black sheep of a wealthy family, as she enters Mortimer University to uncover the truth behind her sister's mysterious death. Obsessed with death and driven by secrets, Salem is soon entangled with Cazimir van der Waal—a chaotic, brooding artist and teaching assistant with a hidden past. Their intense, rivals-to-lovers relationship unfolds amid secret societies, missing girls, and deadly mysteries on campus. As danger closes in, passion ignites between fire and ice. *Enigma* is a twisted, suspenseful tale of obsession, love, and peril set in an academic underworld. ———————————————— #fiction#darkromance#fantasy#romantasy#darkacademia@Bookslibraryofficial@free_novellas@the_ancient_library

Velvet Pages | eLibrary 🥂

@bookslibraryofficial · Post #1473 · 16.11.2025 г., 15:17

📖Title : Blackthorn ✍️Author : J.T. Geissinger ⭐️Rating : 4.03/5 (Goodreads) 📆Published : Nov 04, 2025 ———————————————— Summary:Blackthorn follows Maven Blackthorn as she returns to her haunted hometown after her grandmother’s funeral—only to discover the body has mysteriously vanished. Caught in a generations-old feud between the Blackthorns and the powerful Croft family, Maven is forced to confront Ronan Croft, her first love and the son of her mother’s suspected killer. Their dangerous chemistry resurfaces as whispers of occult rituals, buried secrets, and horrific betrayals emerge. As Maven digs deeper, she uncovers a terrifying truth that threatens everyone she loves. In a town where the dead refuse to rest, love becomes both a weapon and a deadly curse. ———————————————— #romance#gothic#romantasy#fantasy#paranormal@Bookslibraryofficial@free_novellas@eternalmantra