TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #146 · 16 сеп.

Функция sub в regex может принимать функцию в качестве аргумента repl. 📄 Из документации: If repl is a function, it is called for every non-overlapping occurrence of pattern. The function takes a single match object argument, and returns the replacement string. То есть для каждого совпадения будет вызвана функция для вычисления замены вместо замены на одну и ту же строку для всех совпадений. Иными словами, для замены разных совпадений на разные строки не потребуется запускать re.sub() много раз для каждой строки замены. Достаточно определить функцию, которая вернёт строку для каждого из совпадений. Описание слишком запутанное🤔, давайте лучше рассмотрим на простом примере: Создаем карту замены. То есть какие строки на какие требуется менять. remap = { 'раз': '1', 'два': '2', 'три': '3', 'четыре': '4', 'пять': '5', } Пишем функцию поиска строки для замены. Единственным аргументом будет объект re.Match. Используя данные этого объекта мы вычисляем замену on-the-fly! def get_str(match: re.Match): word = match.group(1) return remap.get(word.lower()) or word Пример текста. text = '''Раз Два Три Четыре Пять Вместе будем мы считать Пять Четыре Три Два Раз Мы считать научим вас ''' Теперь запускаем re.sub и вместо строки замены (repl) подаём имя функции. (Данный паттерн ищет отдельные слова в тексте) >>> print(re.sub(r'(\w+)', get_str, text)) 1 2 3 4 5 Вместе будем мы считать 5 4 3 2 1 Мы считать научим вас Думаю, достаточно наглядно 🤓 #libs#regex

Hashtags

Резултати

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

Пребарај: #cube

当前筛选 #cube清除筛选
🏆 Premium, NFT, Tokens

@giiveaways · Post #3334 · 06.12.2024 г., 06:29

Another mining has appeared in Telegram, in this one we are farming the token $CUBE 🏆Start CUBE Mining Entry price is - 39⭐️ The price may increase at any time to avoid the load! You can also complete tasks for free and get entry! Don't miss out! Get in among the first! Link ➡️@Cubeapp_bot We will follow the project and its development! ⭐️Buy stars for ton⭐️ #cube#ton

Hashtags

In Game ❓ CUBES has released a useful update — now you can unite with the whole clan and mine the pool! ❤️ Now, together with #TonEvents we farm cubes even more efficiently and divide the loot among everyone, in proportion to your contribution: 2.5% of the production goes to the development of the pool, 12.5% ​​goes to the lucky person who gets the cube, and the remaining 85% is divided among all pool participants ⛏ Each of you can boost our pool, that is, add 1,000 drops to the boost, then the next level of the pool will open and farming will become even more profitable, especially after halving, so we need to collect 500,000 drops. ⚰️ After the intermediate drop from #CUBE, the hamsters “abandoned ship,” but real miners know that now is the time to farm. 👍 Therefore, we all join in and raise our pool to the top, because the next halving is just around the corner. ⚡️Boost | 🌐Twitter

Red Coins Club

@redcoinsclub · Post #435 · 06.12.2024 г., 06:15

В Telegram появился еще один майнинг, в нем мы фармим токен $CUBE 🏆Запустить Майнинг CUBE Цена входа составляет — 19⭐️ Цену могут повысить в любой момент, дабы избежать нагрузки! Также можно выполнить задания бесплатно и получить вход! Не пропускаем! Залетаем в числе первых! Ссылка ➡️@Cubeapp_bot Будем следить за проектом и его развитием! ⭐️Купить звёзды за ton⭐️ #cube#ton

Hashtags

🏆 Premium, NFT, Tokens

@giiveaways · Post #3355 · 11.12.2024 г., 16:47

➡️We participate in 4 miners, all of which are paid: 1.#⃣Memhash (entry price — 150⭐️) 2.CUBE (entry price — 199/39⭐️) 3.Fomohash_bot (entry price — 150⭐️) 4.⚡️BIT App (entry price — 500⭐️) --------‐------------------ ⭐Buy stars with TON⭐ #cube#fomo#memhash

Red Coins Club

@redcoinsclub · Post #448 · 11.12.2024 г., 16:47

➡️Мы участвуем в 4 майнерах, четыре из них платные 1.#⃣Memhash(цена входа 150 ⭐️) 2.CUBE( цена входа 199 / 39⭐️) 3.fomohash_bot ( цена входа 150 ⭐️) 4. ⚡️BIT App ( цена входа 500 ⭐️) _________ ⭐Купить звёзды за ton⭐ #cube#fomo#memhash

💎 Auto Text自动回复v5.9.4解锁高级版 46.2 ♻️资源介绍:Auto Text(原Do It Later)是一款简洁好用的以后再做计划程序应用,有了 Do It Later Pro 即使您在睡觉、忙碌或不在手机旁时,也可以给某人你发送短信(SMS) ⬇️本地下载 🔔标签:#安卓软件#PDF#合并#拆分#Cube#Page

12
ПретходнаСтраница 1 од 2Следна