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

Резултати

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

Пребарај: #dokwon

当前筛选 #dokwon清除筛选
NEWS 鏈新聞-ABMedia

@abmedia_news · Post #24121 · 25.04.2026 г., 04:01

【🚀 交易市場|Jane Street 請求法院駁回 Terraform Labs 對 UST 崩盤之索賠訴訟 】 #DoKwon#LUNA 📍 請見報導: https://abmedia.io/jane-street-asks-court-to-reject-terraform-claims-tied-to-ust-luna-crash 📍 訂閱鏈新聞頻道:https://linktr.ee/abmedia.io

Hashtags

Venture Village Wall 🦄

@venturevillagewall · Post #3730 · 27.12.2024 г., 16:00

Do Kwon Extradited to the USA Montenegro's Justice Minister Bojan Bozovic has ordered the extradition of Do Kwon, founder of Terra, to the United States. This comes after the court denied Kwon's appeal against extradition. Kwon remains under scrutiny for alleged fraud amounting to $4.47 billion, and was arrested in March 2023. His extradition allows U.S. authorities to pursue charges related to investor deception and wealth concealment. For more details, check the full report here. #Terra#LUNA#DoKwon#crypto#extradition#Montenegro#law#fraud#SEC#blockchain

Venture Village Wall 🦄

@venturevillagewall · Post #3832 · 09.01.2025 г., 19:00

Major Crypto Transactions and Updates Today! 🚨 Significant XLM Transfers: 46,885,889 #XLM ($18.6M) and 68,463,954 #XLM ($27.2M) moved to SDF Operations. 🤑 0G Foundation raises $30M selling AI nodes, distributing up to 15% of token supply over 3 years. More Details 🔄 Key metrics identified by CryptoQuant for Bitcoin's price recovery. Link 👀 US authorities approved the sale of Silk Road Bitcoins worth $6.58B. Link 📈 Binance reports over 250 million users. Link 🧑‍⚖️ Trial for Terra's Do Kwon set for 2026. Link 🔉 Circle donates $1 million in USDC to Trump's inauguration committee. Link #XLM#AI#Crypto#VC#DeFi#Bitcoin#Ethereum#Trading#Investment#Blockchain#Finance#Security#Circle#DonaldTrump#Fundraising#SilkRoad#Binance#Terra#DoKwon#CryptoQuant

Venture Village Wall 🦄

@venturevillagewall · Post #3780 · 03.01.2025 г., 10:00

Bitcoin Turns 16: Celebrating Blockchain's Birth 🎉 Bitcoin celebrates its 16th anniversary today, marking the generation of its genesis block on January 3, 2009, by Satoshi Nakamoto. This milestone began a monetary revolution focused on decentralization and sovereignty. 🔗 Read more: Celebrating Bitcoin 🔗 Earlier report: Identity of Satoshi Nakamoto Revealed? ⚖️ On a legal note, Do Kwon faces serious accusations including fraud and money laundering, with a potential prison sentence of 130 years if convicted. His next court hearing is set for January 8. 🔗 More on Kwon: Reuters 🔮 Experts predict significant developments for cryptocurrency and AI integration by 2025, with Bitcoin potentially hitting $500,000. #Bitcoin#SatoshiNakamoto#DoKwon#Terra#Crypto#Blockchain#Fraud#MoneyLaundering#AI#VC#Economy #2025 #Cryptocurrency#Investment#BlockchainTechnology#Legal#Innovation#Milestone#Anniversary#Decentralization#PeerToPeer

Venture Village Wall 🦄

@venturevillagewall · Post #3824 · 08.01.2025 г., 22:00

Cuban Prefers Bitcoin Over Gold in Crisis Billionaire Mark Cuban states he prefers holding Bitcoin over gold in economic downturns, citing higher value potential. In Q4 2024, MicroStrategy purchased 194,180 BTC. Companies like KULR Technology, Rumble, and Genius Group are also adding Bitcoin to their balance sheets. Meanwhile, Do Kwon faces trial in 2026 for TerraUSD's $40 billion collapse. Additionally, 50 million USDC was burned at USDC Treasury. Analysts from Fidelity Digital Assets predict significant Bitcoin growth in 2025, potentially driven by countries accumulating Bitcoin as strategic reserves. #Bitcoin#Crypto#VC#MarkCuban#MicroStrategy#KULR#Rumble#GeniusGroup#DoKwon#TerraUSD#USDC#Fidelity#ETB#DigitalAssets#EconomicCrisis#Forecast#Cryptocurrency

Venture Village Wall 🦄

@venturevillagewall · Post #3858 · 12.01.2025 г., 19:00

Weekly Crypto Market Highlights 🔹 Crypto market shows volatility amid stock decline. 🔹 US Justice Department authorized sale of Silk Road bitcoins. 🔹 Court sets hearing date for Do Kwon's case. 🔹 Charges filed against operators of crypto mixers Blender and Sinbad. 🔹 In Russia, record crypto seizure to be used for state income. Read more in the full ForkLog Digest. #Crypto#Bitcoin#DoKwon#SilkRoad#Blender#Sinbad#Russia#WeekInReview#MarketVolatility#US#Justice#KYC#DeFi#Cryptocurrency#MarketOverview#Blockchain#AML#Regulation#News#ForkLog