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

Резултати

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

Пребарај: #singsinggaming

当前筛选 #singsinggaming清除筛选
SingSing Announcement

@singsingchannel · Post #1157 · 03.01.2025 г., 08:28

🚨 Exciting News, Blacksmiths! 🔥 The rewards for the Top Blacksmith Event have been fullydistributed! If you hammered your way to the leaderboard, it’s time to check your wallets and celebrate your well-earned treasures. ⚒️💎 We’re in awe of the dedication and skill you’ve shown during this event. Your efforts have truly forged an unforgettable journey! 💪✨ 💬 Got feedback or want to share your rewards? Drop us a message—we love hearing from you! 👉 Don’t rest your hammers just yet. Bigger and bolder events are on the horizon. Stay tuned! 🚀🌟 #SingSingGaming#CommunityPower 🎤Announcement| Mystic Garden Game |Chat| Spotlight Channel

SingSing Announcement

@singsingchannel · Post #1151 · 31.12.2024 г., 07:03

⏳ Final Hours: Top Blacksmiths Event Ends Soon! ⏳ Only a few hours left to forge your way to the top! 🔥 Event Details: ✅End Time: 14:00 UTC - Dec 31 ✅Reward Pool: 150,000 AURA + $100 $SING 🎉 Top 50 Blacksmiths will soon be revealed! 🏆 Tiebreaker Rule: If points are tied, the Blacksmith with the higher pot tier will rank higher. This is your moment—keep forging and secure your spot on the leaderboard! 🚀 #SingSingGaming#BlacksmithChallenge

SingSing Announcement

@singsingchannel · Post #1063 · 30.11.2024 г., 04:32

🌿 Curious about Mystic Garden? The wait is almost over... 🌟 ✨ Be among the first to step into this magical world! 👉 Join AURA Launchpool now and secure your exclusive ticket to explore Mystic Garden! AURA Launchpool 🔗https://t.me/SingSing_TG_bot/app?startapp=_launchpool #MysticGarden#Launchpool#SingSingGaming

SingSing Announcement

@singsingchannel · Post #1108 · 14.12.2024 г., 13:37

🌟 Big News for Mystic Garden Players! 🌟 🎮 We've just launched a community chat channel for Mystic Garden by SingSing! 💬 Join now to get: ✅ The best support ✅ Tips & tricks from fellow players ✅ Exclusive updates 👉JOIN NOW:https://t.me/mysticgardenchat Let’s grow this magical community together! 🌿✨ #MysticGarden#CommunityChat#SingSingGaming

SingSing Announcement

@singsingchannel · Post #1060 · 29.11.2024 г., 03:19

🎉Mystic Garden Beta Test Whitelist 🌿 🌟 How to secure your spot on the Whitelist: 👉 Stay active in Mystic Garden Launchpool (AURApool) for 2 weeks continuously! 🎁 Beta Tester Benefits: 1️⃣ Early access to experience the game before anyone else! 2️⃣ Double your in-game deposits after the official launch. 3️⃣Exclusive Beta Test rewards just for participants! ⏳ Limited slots available – start mining and claim your whitelist spot now! #MysticGarden#BetaTestWhitelist#Launchpool#SingSingGaming