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

Резултати

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

Пребарај: #futureofrussia

当前筛选 #futureofrussia清除筛选
ART UNITES THE WORLD

@artunitesworld · Post #166 · 05.03.2026 г., 14:50

🖼 NFT + Physical Art - One of the Key Trends of 2026 The digital asset market is evolving rapidly. Just a few years ago, NFTs were primarily associated with digital images. Today, however, a new ownership model is emerging - a hybrid of physical art and blockchain technology. In 2026, this trend is accelerating: collectors, artists, and technology ecosystems are combining classical artworks with NFT passports secured on the blockchain. 🫥 What does this change? 🔹 Authenticity - a digital certificate verifies authorship and provenance. 🔹 Transparency - ownership history is recorded and cannot be altered. 🔹 Security - significantly reduces the risk of counterfeiting. 🔹 Liquidity - the asset can be integrated into the digital environment and participate in Web3 tools. 🔹 A new ownership model - a physical object receives a unique digital identifier. 🧬 In essence, we are witnessing the emergence of a new asset class: Art + Blockchain = a hybrid form of value. This is no longer an experiment or the NFT hype wave of 2021. It represents a more mature phase of market development - where technology enhances traditional art rather than replacing it. 🌍 Global practice shows that digital asset identification is becoming the standard. Art is one of the first sectors where this transformation is especially logical. To better understand how art meets blockchain, we invite you to explore DigitalExchange.art 🚀 Within the MirraCoin ecosystem, we are not only closely following this direction - we are actively building blockchain integrations, because the future of the digital economy is being shaped by exactly these hybrid solutions. 🚀 The future of assets is not “digital instead of physical.” 🚀 The future is synergy. • Physical value. • Digital protection. • Transparent history. • Web3 integration. 🇷🇺 In Russia, this global trend is only beginning to scale - together with the MirraCoin.io ecosystem 😎 #MirraCoin#MIRRC#NFT#DigitalExchangeArt#Blockchain#Web3#Art#Cryptocurrency#FutureOfRussia#CryptoNews#MadeInRussia @MirraChannel😎