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

Резултати

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

Пребарај: #sweeps

当前筛选 #sweeps清除筛选
bjjfanaticsinstructionals

@bjjfanaticsinstructionals · Post #1936 · 18.04.2026 г., 19:16

🔥NEW RELEASE🔥 😁Systematically Attacking The Half Guard and Scrimmaging: Whizzer vs Underhook by Gordon Ryan😁 ➡️In Systematically Attacking The Half Guard and Scrimmaging: Whizzer vs Underhook, Gordon Ryan breaks down one of the most common—and misunderstood—positions in all of Jiu-Jitsu, and turns it into a clear, repeatable system you can rely on every time. ➡️Widely regarded as the most accomplished No-Gi grappler of all time, Gordon is known for his unmatched submission rate and his ability to teach complex positions with precision and clarity. This series is a perfect example of that. $349😍$24.99😍 ❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️ 📱Payment: 📱📱📱 💰Submeta FOR FREE 👑MasterClass ✈️@bjjfanaticsinstructionals #GordonRyan#Sweeps#NoGi#NewWave 💁‍♀️Buy 💁‍♀️

bjjfanaticsinstructionals

@bjjfanaticsinstructionals · Post #1892 · 18.12.2025 г., 00:34

🔥NEW RELEASE🔥 😁Knee Lever Masterclass by Brian Glick😁 ➡️The Knee Lever Masterclass from Brian Glick, a John Danaher black belt and one of BJJ Fanatics’ best-selling instructors, is your complete system for turning one of Jiu-Jitsu’s most underrated techniques into a powerful, all-position weapon ➡️Known for his world-class instruction, clear communication, and simple, effective systems, Brian once again delivers an instructional packed with precise details and universal concepts that make complex ideas easy to apply. $197😍$14.99😍 ❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️ 📱Payment: 📱📱📱 💰Submeta FOR FREE 👑MasterClass ✈️@bjjfanaticsinstructionals #BrianGlick#Sweeps#NoGi#NewWave 💁‍♀️Buy 💁‍♀️

bjjfanaticsinstructionals

@bjjfanaticsinstructionals · Post #1873 · 05.11.2025 г., 03:52

🔥NEW RELEASE🔥 😁Master The Move: The Butterfly Guard Sweep Sumi Gaeshi by John Danaher😁 ➡️In Master The Move: The Butterfly Guard Sweep Sumi Gaeshi, Danaher breaks down what many consider the single most effective sweep in grappling. ➡️Now, for the first time, Danaher reveals the complete system behind the Sumi Gaeshi sweep from butterfly guard — the same position that connects effortlessly to leg locks, back takes, and devastating top control sequences. $197😍$19.99😍 ❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️ 📱Payment: 📱📱📱 💰Submeta FOR FREE 🌈UFC Picks 👑MasterClass ✈️@bjjfanaticsinstructionals #JohnDanaher#Sweeps#NoGi#NewWave 💁‍♀️Buy 💁‍♀️

bjjfanaticsinstructionals

@bjjfanaticsinstructionals · Post #1931 · 12.04.2026 г., 00:30

😁Top 10 Sweeps and Reversals by Magid Hage😁 ➡️In Top 10 Sweeps and Reversals, Magid Hage breaks down the most basic, high-percentage sweeping techniques that every Brazilian Jiu-Jitsu practitioner should have in their game. ➡️This course focuses on simplicity, timing, and efficiency, showing you how to off-balance your opponent and reverse the position with minimal strength and maximum control. $79😍$9.99😍 ❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️ 📱Payment: 📱📱📱 💰Submeta FOR FREE 👑MasterClass ✈️@bjjfanaticsinstructionals #MagidHage#Sweeps#NoGi#IBJJF 💁‍♀️Buy 💁‍♀️

bjjfanaticsinstructionals

@bjjfanaticsinstructionals · Post #1868 · 15.10.2025 г., 17:48

😁Precision Sweeps And Wrestle Ups From The Seated Position By Shawn Melanson😁 ➡️Master the art of disrupting standing passers with surgical precision. In his fourth and most dynamic instructional to date, best-selling BJJ coach Shawn Melanson delivers a comprehensive system for attacking from the seated guard — blending positional off-balancing, precision timing, and relentless wrestle-ups to systematically frustrate and dismantle your opponent’s passing game. ➡️Shut down standing passers with precision sweeps, wrestle-ups, and off-balancing tactics from seated guard in Shawn Melanson’s latest high-level BJJ instructional. $79😍$9.99😍 ❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️ 📱Payment: 📱📱📱 💰Submeta FOR FREE 🌈UFC Picks 👑MasterClass ✈️@bjjfanaticsinstructionals #ShawnMelanson#Sweeps#NoGi#WrestleUp 💁‍♀️Buy 💁‍♀️