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 слични објави

Пребарај: #hft

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

@CoinSonar · Post #244039 · 18.04.2026 г., 07:34

#HFT | Volume spike (USDT PAIR) 39 times the average volume 128.56K USDT traded in 15 min └Buying vol: 75.31K USDT 🟢 Boost score: 5/10 24h Vol: 310.07K USDT (Binance) Price: 0.0176 (-2.2% in 24h)

Hashtags

Pro Analysis

@proanalysistrader · Post #28365 · 04.01.2025 г., 17:27

#HFT/USDT analysis : #HFT has broken out and retested the previously respected zone. The price is expected to rebound from this level and resume its bullish momentum, aiming to test the previous highs. This indicates a strong potential for upward movement as the market seeks to continue its bullish trend. TF : 1D Entry : $0.2230 Target : $0.3200 SL : $0.1770

Hashtags

Pro Analysis

@proanalysistrader · Post #27800 · 05.08.2024 г., 17:10

#HFT/USDT analysis : #HFT is in downtrend, trading below 200ema. Price is in pullback phase. Let it approach resistance zone and reject from there to downside as previous swing low is expect to be tested. TF : 15min Entry : $0.1390 Target : $0.1163 SL : $0.1483

Hashtags

American Crypto©

@americancryptotrading · Post #27436 · 12.11.2025 г., 11:15

🇺🇸#HFT/USDT is getting ready to break out from the descendingchannel on the weekly chart👀 Bullish case📈 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27258 · 23.05.2025 г., 09:49

🇺🇸#HFT/USDT is on the edge of breaking through the descendingresistance on the daily chart🧐 Looking for a leg upward✈️ American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27105 · 02.01.2025 г., 17:17

🇺🇸#HFT/USDT is trading within the descendingchannel on the 3D chart💁‍♂️ Time to break out and rally📈 American Crypto©

Hashtags

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