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

Резултати

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

Пребарај: #web3ai

当前筛选 #web3ai清除筛选
EdgeMarket.AI 📣

@edgemarketai · Post #8169 · 09.05.2026 г., 11:11

The internet rewards attention. EdgeMarket is designed to reward accuracy. We are building a decentralised validation layer where communities collectively identify signal, filter noise, and strengthen truth through time. Noise: • Clickbait • Manipulation • Speculation • Fear • Bias Signal: • Clarity • Accuracy • Alignment Maybe the future isn’t predicted. Maybe it’s discovered. $SIGNAL powers the ecosystem. Validate. Earn. Shape the future. #EdgeMarket#SIGNAL#Web3AI#TruthValidation#CollectiveIntelligence

GPT360

@gpt360_announcement · Post #1549 · 08.04.2025 г., 09:44

🚨𝐆𝐏𝐓𝟑𝟔𝟎 𝐢𝐬 𝐣𝐨𝐢𝐧𝐢𝐧𝐠 𝐭𝐡𝐞 𝐇𝐲𝐫𝐚 𝐀𝐌𝐀!🚨 Hey Web3 fam! We're excited to announce that our CMO Anton Sheleg will be joining an epic AMA session hosted by Hyra101 to talk all things Web3 AI vs. centralized giants — and why this revolution is just getting started👀 ⬇️ 𝐓𝐨𝐩𝐢𝐜: AI Wars 2025: Can Web3 AI Overtake Centralized Giants? ⬇️ 𝐃𝐚𝐭𝐞: April 8, 2025 ⬇️ 𝐓𝐢𝐦𝐞: 13:00 (UTC) ⬇️ 𝐖𝐡𝐞𝐫𝐞: https://x.com/i/spaces/1OdJrDmzzrlKX ⚡️ 𝐏𝐚𝐫𝐭𝐢𝐜𝐢𝐩𝐚𝐧𝐭𝐬: GPT360, Hyra Network, GPUAI 🔥 We'll be diving deep into strategy, vision, and what’s next for AI on-chain Tag your friends, bring your questions, and see you there! #GPT360#HyraNetwork#AIWars2025#Web3AI#AMA#DecentralizedAI

Crypto M - Crypto News

@CryptoM · Post #65388 · 13.04.2026 г., 04:14

🚀 AINFT Platform Surpasses 700,000 Users, Advances in Web3 AI The AINFT platform has officially exceeded 700,000 users, according to official data. According to Odaily, the growing user base and the continuous enhancement of AI model capabilities are propelling it to become a leading AI platform in the Web3 sector. AINFT currently offers users AI models ready for production and fully supports the execution of on-chain automated workflows, facilitating a rapid transition from creative ideas to on-chain implementation. Leveraging its expanding community and open technical architecture, AINFT aims to lower the barriers to using Web3 AI, enabling more efficient deployment of innovative applications. #AINFT#700000Users#Web3#AIPlatform#AI#Blockchain#OnChain#AutomatedWorkflows#Web3AI#Innovation#Technology#Community