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

Резултати

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

Пребарај: #seriesa

当前筛选 #seriesa清除筛选
Davr On

@davroncapital · Post #187 · 28.01.2026 г., 15:33

🚛 We’re building the future of freight operations. Datatruck has raised a $12M Series A round led by Avenue Growth Partners, to accelerate our mission of transforming how carriers manage operations and cash flow through AI-powered automation. Our AI-native TMS platform unifies dispatch, finance, and digital workflows into one intelligent system — empowering trucking companies to make faster, smarter, and more profitable decisions across their businesses. This investment will help us expand our product ecosystem, deepen AI capabilities, and scale adoption across North America’s freight network. We’re just getting started — the road ahead is wide open. 💡 👉 Learn more: Datatruck.io #freighttech#logistics#transportation#trucking#saas#ai#seriesa#startup#funding

Crypto M - Crypto News

@CryptoM · Post #65090 · 11.04.2026 г., 00:14

🚀 Crypto Startups Secure $76 Million in Funding in Early Q2 2026 DefiLlama data reveals that crypto startups raised $76 million in the first week of the second quarter of 2026. According to Odaily, the total funding for the year has approached $500 million. Key funding rounds this week include: Pharos secured $44 million in a Series A round with participation from SNZ Holding, Chainlink, and Flow Traders. The company focuses on building a high-performance Layer 1 blockchain compatible with Ethereum applications, emphasizing RWA and decentralized infrastructure networks. Oh raised $7.5 million in a Series A round led by Maven 11, with contributions from L1 Digital, Hashed, Auros Global, and Maelstrom. The project aims to develop a Web3 AI platform offering decentralized AI service tools like OhChat. Kulipa completed a $6.2 million seed round led by Flourish Ventures and 1kx, with participation from White Star Capital and Fabric Ventures. The company provides branded payment cards for crypto wallets, enabling the conversion of digital assets to traditional currency at checkout. #CryptoStartups#Funding#Q22026#Pharos#SeriesA#Blockchain#Layer1#Ethereum#Oh#Web3#AI#DecentralizedAI#Kulipa#SeedRound#PaymentCards#CryptoWallets#DigitalAssets#TraditionalCurrency