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 слични објави

Пребарај: #beststartupproject

当前筛选 #beststartupproject清除筛选
StartupBase

@startupbaseuz · Post #6336 · 06.11.2025 г., 10:21

🇦🇿 Ozarbayjonda Best Startup Project yarim final bosqichi bo‘lib o‘tdi! “Digital Startup Awards” (DSA) butun mintaqa bo‘ylab eng iqtidorli startap asoschilarini birlashtirishda davom etmoqda. 🌟 Dunyo bo‘ylab kelib tushgan 350 dan ortiq ariza orasidan 20 ta ozarbayjonlik startap o‘z innovatsion g‘oyalarini taqdim etdi. Natijada ikki finalchi — “Starkids” va “Tryverse” — joriy yil dekabr oyida Toshkentda bo‘lib o‘tadigan Grand Final bosqichiga yo‘llanma oldi. 🚀 Jarayon tobora qizg‘in tus olmoqda — yakuniy bosqichga yaqinlashar ekanmiz, yangiliklarni kuzatishda davom eting! 📖To‘liq maqolani o'qing: startupbase.uz — 🇦🇿Azerbaijan Hosts Its Best Startup Project Semifinal! The Digital Startup Awards (DSA) continues to bring together the brightest founders from across the region. 🌟 Out of 350+ applications globally, 20 startups from Azerbaijan took the stage to pitch their innovative ideas — and two finalists, Starkids and Tryverse, have earned their spot in the Grand Final in Tashkent this December. 🚀 The momentum is growing — stay tuned as we move closer to the final showdown! 📖Read the full article here: startupbase.uz #DSA#BestStartupProject#ITParkUzbekistan#AzerbaijanStartups#CentralAsiaStartups

IT Park Ventures

@ITParkVentures · Post #495 · 06.11.2025 г., 11:30

🇦🇿 Ozarbayjonda Best Startup Project yarim final bosqichi bo‘lib o‘tdi! “Digital Startup Awards” (DSA) butun mintaqa bo‘ylab eng iqtidorli startap asoschilarini birlashtirishda davom etmoqda. 🌟 Dunyo bo‘ylab kelib tushgan 350 dan ortiq ariza orasidan 20 ta ozarbayjonlik startap o‘z innovatsion g‘oyalarini taqdim etdi. Natijada ikki finalchi — “Starkids” va “Tryverse” — joriy yil dekabr oyida Toshkentda bo‘lib o‘tadigan Grand Final bosqichiga yo‘llanma oldi. 🚀 Jarayon tobora qizg‘in tus olmoqda — yakuniy bosqichga yaqinlashar ekanmiz, yangiliklarni kuzatishda davom eting! 📖To‘liq maqolani o'qing: startupbase.uz — 🇦🇿Azerbaijan Hosts Its Best Startup Project Semifinal! The Digital Startup Awards (DSA) continues to bring together the brightest founders from across the region. 🌟 Out of 350+ applications globally, 20 startups from Azerbaijan took the stage to pitch their innovative ideas — and two finalists, Starkids and Tryverse, have earned their spot in the Grand Final in Tashkent this December. 🚀 The momentum is growing — stay tuned as we move closer to the final showdown! 📖Read the full article here: startupbase.uz #DSA#BestStartupProject#ITParkUzbekistan#AzerbaijanStartups#CentralAsiaStartups

StartupBase

@startupbaseuz · Post #6332 · 05.11.2025 г., 14:48

🇲🇳 Mongoliyada Best Startup Project yarim final bosqichi boshlandi! “Digital Startup Awards” (DSA) dasturi qizg‘in davom etmoqda — Mongoliya rasman o‘zining ilk “Best Startup Project” tanlovini o‘tkazib, eng yaxshi finalchilarni saralab oldi! 🚀 350 dan ortiq arizalar orasidan UWISH va EGUNE Mo‘g‘uliston yarim finalida g‘olib chiqdi va joriy yilning dekabr oyida Toshkentda bo‘lib o‘tadigan Grand finalda ishtirok etadi. 📖To‘liq maqolani o'qing: startupbase.uz — 🇲🇳Mongolia Kicks Off the Best Startup Project Semifinals! The Digital Startup Awards (DSA) program is in full swing — and Mongolia has officially hosted the first Best Startup Project competition, selecting its top finalists! 🚀 Out of 350+ applications, UWISH and EGUNE became the winners of the Mongolian semifinal and will compete in the Grand Final in Tashkent this December. 📖Read the full article here: startupbase.uz #DSA#BestStartupProject#ITParkUzbekistan#StartupEcosystem#MongoliaStartups#Innovation#Entrepreneurship#CentralAsiaStartups