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

Резултати

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

Пребарај: #ether

当前筛选 #ether清除筛选
SIGNAL

@finsignal · Post #3127 · 23.05.2024 г., 06:55

Good morning, everyone! 🌄 🤔 The cue ball froze around 69.500, but the #Ether, despite the sideways bitcoin, is trying to grow and is trading around 3800. I think that they will try to get through the Air today or tomorrow to the 3.850-3.870 area. But then everything will depend on #Bitcoin: if the cue ball supports the market with growth, then the #Ether will be able to go above $ 4,000. 😎In general, nothing has been dented on the market since yesterday and the alignment is still the same.

Venture Village Wall 🦄

@venturevillagewall · Post #4158 · 15.02.2025 г., 10:00

OM Whale Transfers Millions to Binance A significant OM whale (0x17...fe76) transferred 10.711 million OM to Binance today, valued at approximately 80.88 million USD. Previously, this whale had withdrawn OM worth around 4.82 million USD from Binance between March 1-6, 2024. This indicates a potential profit nearing 84 million USD for the whale. More Details #OM#Binance#Crypto#Whale#Investment#Market#Profit#Trading#Blockchain#Ether

Crypto M - Crypto News

@CryptoM · Post #64763 · 09.04.2026 г., 20:15

🚀 Ether Rises Over 6% as Undervaluation Signals Potential Retest of Higher Levels Ether experienced a 6.33% increase, surpassing $2,150, with indicators suggesting a potential retest of the $2,400–$2,500 range. According to NS3.AI, the Capriole Macro Index Oscillator registered a reading of -2.42, indicating that Ether is in a rare undervaluation zone. This development has sparked interest among investors, who are closely monitoring the cryptocurrency for further movements. #Ether#Crypto#Ethereum#Undervaluation#PriceIncrease#Investment#CryptoTrading#NS3AI#ETH

Crypto M - Crypto News

@CryptoM · Post #65226 · 12.04.2026 г., 05:55

🚀 Bitcoin and Ether Prices Could Signal Sustainable Growth, Says Analyst Macro analyst Jordi Visser has suggested that Bitcoin surpassing $76,000 and Ether exceeding $2,400 might indicate the beginning of a sustainable upward trend this year. According to NS3.AI, Visser expressed confidence in the market's resilience, noting that he does not foresee a recession. Additionally, data from the United States Bureau of Labor Statistics revealed that the Consumer Price Index (CPI) for April increased by 3.3% compared to the previous year. #Bitcoin#Ether#Cryptocurrency#MarketAnalysis#SustainableGrowth#MacroEconomics#CPI#Inflation#BTC#ETH