TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #65 · 8 апр.

Небольшой трик с регулярными выражениями который редко вижу в чужом коде. Допустим, вам нужно распарсить простой текст и вытащить оттуда пары имя+телефон. Вернуть всё это надо в виде списка словарей. Возьмем очень простой пример текста. >>> text = ''' >>> Alex:8999123456 >>> Mike:+799987654 >>> Oleg:+344456789 >>> ''' Соответственно, для выделения нужных элементов будем использовать группы. Получится такой паттерн: (\w+):([\d+]+) Как мы будем формировать словарь из найденных групп? >>> import re >>> results = [] >>> for match in re.finditer(r"(\w+):([\d+]+)", text): >>> results.append({ >>> "name": match.group(1), >>> "phone": match.group(2) >>> }) >>> print(results) [{'name': 'Alex', 'phone': '8999123456'}, ...] Можно немного сократить запись используя zip >>> results = [] >>> for match in re.finditer(r"(\w+):([\d+]+)", text): >>> results.append(dict(zip(['name', 'phone'], match.groups()))) Но есть способ лучше! Это именованные группы в regex. Можно в паттерне указать имя группы и результат сразу забрать в виде словаря. >>> for match in re.finditer(r"(?P<name>\w+):(?P<phone>[\d+]+)", text): >>> results.append(match.groupdict()) То есть всё что я сделал, это добавил в начале группы (внутри сбокочек) такую запись: (?P<group-name>...) Теперь найденная группа имеет имя и можно обратиться к ней как к элементу списка >>> name = match['name'] Либо забрать сразу весь словарь методом groupdict() >>> match.groupdict() #tricks#regex

Резултати

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

Пребарај: #interestrate

当前筛选 #interestrate清除筛选
Crypto M - Crypto News

@CryptoM · Post #64632 · 09.04.2026 г., 12:05

🚀 Poland's Central Bank Keeps Benchmark Rate Unchanged at 3.75% Poland's central bank has decided to maintain its benchmark interest rate at 3.75%, aligning with market expectations. According to Jin10, this decision reflects the bank's current monetary policy stance amid ongoing economic conditions. The unchanged rate suggests a cautious approach as the bank monitors inflationary pressures and economic growth. This move is consistent with the central bank's efforts to balance economic stability and inflation control. #Poland#CentralBank#InterestRate#MonetaryPolicy#Inflation#EconomicGrowth#EconomicStability

Crypto M - Crypto News

@CryptoM · Post #64815 · 10.04.2026 г., 01:43

🚀 South Korea Maintains Key Interest Rate Amid Economic Resilience South Korea's central bank announced on April 10 that it will keep the seven-day repo rate unchanged at 2.5%, continuing its steady policy stance since July last year, in line with market expectations. According to Jin10, this decision comes amid stable inflation and relatively resilient economic growth. In March, South Korea's consumer prices rose by 2.2% year-on-year, slightly up from February's 2% increase, yet still close to the central bank's target level. In February, the central bank had already raised its growth outlook for 2026. However, the ongoing Middle East conflict is posing risks to both inflation and growth. As a major importer heavily reliant on Middle Eastern energy, South Korea faces rising import costs due to global oil and gas price hikes. Additionally, the South Korean won has weakened significantly in recent weeks, influenced by foreign capital outflows and rising oil prices. Despite these challenges, South Korea's economic growth remains resilient. March exports showed strong momentum, driven by record demand for AI-related semiconductors and robust exports to China. #SouthKorea#InterestRate#EconomicGrowth#Inflation#CentralBank#Exports#AI#Semiconductors#OilPrices#Currency#MiddleEastConflict

Crypto M - Crypto News

@CryptoM · Post #65153 · 11.04.2026 г., 13:14

🚀 Middle East Conflict and Rising Oil Prices Impact Crypto Market The ongoing conflict in the Middle East and increasing crude oil prices are influencing the cryptocurrency market through interest-rate and risk channels. According to NS3.AI, these developments are contributing to bear market pressures. Additionally, Hong Kong's stablecoin licensing, disputes over prediction market rules, and Hyperliquid's crude oil trading are emerging as significant themes in the current market landscape. #MiddleEastConflict#RisingOilPrices#CryptoMarket#InterestRate#RiskChannels#BearMarket#NS3AI#StablecoinLicensing#PredictionMarket#Hyperliquid#CrudeOilTrading