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

Резултати

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

Пребарај: #nmr

当前筛选 #nmr清除筛选
Coin Sonar

@CoinSonar · Post #244171 · 18.04.2026 г., 12:26

#NMR | Volume spike (USDT PAIR) 317 times the average volume 98.25K USDT traded in 1 min └Selling vol: 61.49K USDT 🔴 Boost score: 1/10 24h Vol: 445.92K USDT (Binance) Price: 8.75 (-1.3% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243656 · 17.04.2026 г., 13:09

#NMR | Volume spike (USDT PAIR) 28 times the average volume 130.67K USDT traded in 15 min └Selling vol: 79.47K USDT 🔴 Boost score: 1/10 24h Vol: 445.92K USDT (Binance) Price: 8.86 (-1.3% in 24h)

Hashtags

American Crypto©

@americancryptotrading · Post #27188 · 18.03.2025 г., 12:27

🇺🇸#NMR/USDT has crossed through the descendingresistance on the daily timeframe🔍 Climbing higher from here🐃 American Crypto©

Hashtags

Alphavave Traders ️️️

@alphavave · Post #3048 · 25.12.2025 г., 02:00

#NMR is crushing it with a 1,925% profit! 💰💵 That's a 1️⃣9️⃣🔤 return on your money from just one signal😉💵 Not going to lie, we have pretty much cracked the crypto code here. The results speak for themselves. Bet you are wondering how... Too bad most won't ever figure it out💯 you want the Same, this is your last chance🎁 ⚡️Don't miss the Christmas Sale!⚡️ ✅Monthly access is now just $30 (originally $200) ✅6-Month access is now just $75 (originally $500) ✅Lifetime access is now just $188 💵 (originally $1250) Let’s make this your most profitable Christmas yet! 🎉 DM me now! 👉@Kevindexter✅

Hashtags

CRYPTO SIGNALS FREE

@crypto_vip_signals_free · Post #372 · 13.08.2021 г., 05:06

#NMR is a type of hedge fund built by a network of data scientists fundamentally it is a strong project which haven’t pumped much in this altseason and definitely having potential to become a top gainer on binance. Technically NMR is on horizontal support and having bullish OBV divergence on 4H timeframe stochastic RSI looking bullish on 1D so now is the right time to build your position in it before breakout for massive profit😊 Target : 0.001-0.0011-0.00125-0.0015 For premium contatct @cryptomathh

Hashtags

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