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

Резултати

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

Пребарај: #trailer

当前筛选 #trailer清除筛选
Journey to Fluency

@fluencyinenglish · Post #6861 · 14.02.2019 г., 05:57

‍#trailer ❇️Days Gone 🔹 Plot A global pandemic occurred which decimated the globe, turning millions of humans into feral cannibalistic creatures, called Freakers. The remnants of humanity have abandoned towns to seek refuge in the wilderness creating safe zones. ❇️Aftermath Deacon St. John, a member of the Mongrels MC, is among the survivors of the epidemic. Deacon drifts through the wasteland of the Pacific Northwest, never staying in one place for too long. Deacon often takes work as a Bounty Hunter/Mercenary, offering his services in exchange for supplies. However, Deacon learns that there is a price on his head adding to his list of enemies. @fluencyinenglish @ieltsstrategies

Hashtags

Journey to Fluency

@fluencyinenglish · Post #6282 · 26.07.2018 г., 19:31

‍#trailer ❇️GLASS Trailer (2019) @fluencyinenglish Security guard David Dunn uses his supernatural abilities to track Kevin Wendell Crumb, a disturbed man who has 23 personalities. @fluencyinenglish In the trailer (via THR), Sarah Paulson (American Horror Story series) appears as a psychiatrist who describes herself as someone that specializes in “individuals who believe they are superheroes.” Present among her patients at a Philadelphia asylum are Bruce Willis’ David Dunn, Samuel L. Jackson’s Elijah Price, aka Mr. Glass, and James McAvoy’s Kevin Wendell Crumb, aka The Horde. @fluencyinenglish

Hashtags

Journey to Fluency

@fluencyinenglish · Post #6278 · 25.07.2018 г., 10:08

‍#trailer ❇️The passage @fluencyinenglish The plot: 🔹When a botched U.S. government experiment turns a group of death row inmates into highly infectious vampires, an orphan girl might be the only person able to stop the ensuing crisis. @fluencyinenglish

Hashtags

Journey to Fluency

@fluencyinenglish · Post #6251 · 14.07.2018 г., 13:41

‍#trailer ❇️How It Ends [HD] | Netflix The plot: In the midst of an apocalypse, a man struggles to reach his pregnant wife, who is thousands of miles away. @fluencyinenglish @ieltsstrategies

Hashtags

Viral Today

@viral_today · Post #3229 · 21.11.2024 г., 11:31

The live-action adaptation of the beloved How to Train Your Dragon franchise is set to hit theaters on June 13, 2025 @Viral_Today / #trailer

Hashtags

Viral Today

@viral_today · Post #3032 · 19.09.2024 г., 16:38

Black Mirror Season 7 teaser just dropped This globally popular Netflix series has drawn millions of viewers with its chilling, dystopian stories about the dark side of technology. Past episodes like ‘Bandersnatch’ became worldwide hits, and this new season promises more twists and turns. @Viral_Today / #trailer

Hashtags

Viral Today

@viral_today · Post #2975 · 04.09.2024 г., 14:30

🌐 Warner Bros. has released the first trailer for A Minecraft Movie, which hits theaters in April 2025 and stars Jack Black and Jason Momoa. @Viral_Today / #trailer

Hashtags

123•••1011
ПретходнаСтраница 1 од 11Следна