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

Резултати

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

Пребарај: #fil

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

@CoinSonar · Post #243408 · 17.04.2026 г., 01:50

#FIL | Volume spike (USDT PAIR) 58 times the average volume 258.06K USDT traded in 1 min └Buying vol: 179.20K USDT 🟢 Boost score: 5/10 24h Vol: 6.40M USDT (Binance) Price: 0.984 (-1.4% in 24h)

Hashtags

Pro Analysis

@proanalysistrader · Post #28045 · 21.10.2024 г., 13:07

#FIL/USDT analysis : #FIL is currently in an uptrend, consistently making higher highs (HHs) and higher lows (HLs) along the trendline. The price is now retracing towards the 200 EMA, presenting a potential long trade opportunity. The target should be the previous high levels, as the price is anticipated to rise further. TF : 1D Entry : $3.888 Target : $4.662 SL : $3.366

Hashtags

American Crypto©

@americancryptotrading · Post #27613 · 08.05.2026 г., 08:21

🇺🇸#FIL/USDT is approaching the midline of the descendingchannel formation on the 3D chart💁‍♂️ Looking for a rise✈️ American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27570 · 27.03.2026 г., 10:40

🇺🇸#FIL/USDT is printing the descendingchannel formation on the 2W timeframe👨‍💻 A strong rally is approaching🚀 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27525 · 05.02.2026 г., 11:46

🇺🇸#FIL/USDT has found support at the lowerboundary of the descendingchannel formation on the 3D chart👨‍💻 Looking for a leg upward📈 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27490 · 03.01.2026 г., 11:17

🇺🇸#FIL/USDT is rebounding from the lowerborder of the descendingchannel pattern on the 3D chart👨‍💻 Bounce will bring a huge rally🐃 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27457 · 02.12.2025 г., 10:25

🇺🇸#FIL/USDT is currently shaping the descendingchannel formation on the weekly chart👨‍💻 Send it if we break out🚀 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27378 · 17.09.2025 г., 09:00

🇺🇸#FIL/USDT is hovering above the broken descendingresistance line on the daily timeframe🧐 A pump is expected📈 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27268 · 02.06.2025 г., 09:38

🇺🇸#FIL/USDT is retesting the broken descendingresistance line on the daily timeframe🔍 Time to rally🐃 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27164 · 23.02.2025 г., 19:18

🇺🇸#FIL/USDT has found support at the lowerborder of the descendingtriangle formation on the weekly chart👀 Time to bounce and rally📈 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27096 · 24.12.2024 г., 15:01

🇺🇸#FIL/USDT is retesting broken descendingresistance on the weekly chart🧐 Looking for a rise✈️ American Crypto©

Hashtags

123•••56
ПретходнаСтраница 1 од 6Следна