@tsukassadrive · Post #2764 · 24.06.2025 г., 20:02
#textpost ESCAPISTS ONLY
Hashtags
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
Пребарај: #textpost
@tsukassadrive · Post #2764 · 24.06.2025 г., 20:02
#textpost ESCAPISTS ONLY
Hashtags
@tsukassadrive · Post #1941 · 05.08.2024 г., 07:46
#textpost going through some shit rn, but that doesn't mean I have to stop posting...
Hashtags
@tsukassadrive · Post #2972 · 14.12.2025 г., 06:09
#textpost#y2k Pro Tip: Instead of looking for an music with a "y2k aesthetic", just listen to a music from 2000s. HUGE time saver.
@tsukassadrive · Post #2711 · 02.05.2025 г., 00:48
#textpost#random "dreams become real, and what once was real become a dream"
@tsukassadrive · Post #1989 · 12.08.2024 г., 14:29
#random#textpost Pentagon - Collapse (ICO Ost)
@tsukassadrive · Post #2781 · 31.07.2025 г., 23:15
#textpost#random#weebshit CICORU DONMAI! CICORU DONMAI!
@tsukassadrive · Post #1626 · 20.05.2024 г., 07:42
#random#textpost#meme#original I heard you is a doomer, nigga. The world cherishes you, nigga. The world is still when you out of hustle and bustle of the human discourse, nigga. This stillness is boundless, nigga. This stillness makes life worth living, nigga. The world is indeed filled with despair and pain, nigga, but as to counter it, the world is filled with the wonder you can't even imagine, nigga. But don't go filtering out your ordinary life for them life's highs and lows, nigga. Just as you read this text, in this most ordinary moment, you don't experience any of your life's problems, nigga. You have time to read this pasta on the internet, nigga, so don't give in to your thought-autopilot and regain control of your life that is right now, nigga, not in the not-yet existing future or the past that only was, nigga.
@tsukassadrive · Post #1891 · 29.07.2024 г., 10:58
#random#music#textpost#upload
@tsukassadrive · Post #1559 · 01.05.2024 г., 07:45
#random#textpost#music#upload source When I close my eyes, it's a fantasy Perfect plastic life from a magazine Then, when I wake up, it's reality (pretty girls) I can have it all (yeah), live my цикорiй dreams (Kaliii)
@DESI_MEMES_Funny_Jokes · Post #5894 · 29.11.2024 г., 09:04
Dost ko v Lana chahiye tha 🌚 . . . . Tags-#quotesdaily#quote#quotestagram#quotesaboutlife#quoteoftheday#quotes#aesthetic#fypage#fypシ#explore#explorepage#relatabletextpost#relatablequotes#relatable#textpost#thoughtoftheday#thoughts#funnyquotes#funny#trending#bollywoodsongs#bollywood#feed#relatableshit#lovemoments💕#meandher#meandhim❤️#mostloved#manifesting
Hashtags
@DESI_MEMES_Funny_Jokes · Post #5888 · 28.11.2024 г., 16:45
Chaliye swarg se ghum kr aate h 😂🤡 . . . . Tags-#quotesdaily#quote#quotestagram#quotesaboutlife#quoteoftheday#quotes#aesthetic#fypage#fypシ#explore#explorepage#relatabletextpost#relatablequotes#relatable#textpost#thoughtoftheday#thoughts#funnyquotes#funny#trending#bollywoodsongs#bollywood#feed#relatableshit#lovemoments💕#meandher#meandhim❤️#mostloved#manifesting
Hashtags
@DESI_MEMES_Funny_Jokes · Post #5543 · 24.10.2024 г., 13:23
Bolo n chup kahe ho 😆✊🏻 . . . . Tags-#quotesdaily#quote#quotestagram#quotesaboutlife#quoteoftheday#quotes#aesthetic#fypage#fypシ#explore#explorepage#relatabletextpost#relatablequotes#relatable#textpost#thoughtoftheday#thoughts#funnyquotes#funny#trending#bollywoodsongs#bollywood#feed#relatableshit#lovemoments💕#meandher#meandhim❤️#mostloved#manifesting
Hashtags