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

Пребарај: #latestsoftware

当前筛选 #latestsoftware清除筛选
MikroTik.SG

@mikrotiksg · Post #314 · 30.07.2025 г., 06:56

Current MikroTik Software Release RouterOS: 7.19.4 | 6.49.18 Winbox: 3.42 / 4.0beta26 SwitcOS: 2.18 SwitchOS lite: 2.20 If you missed 7.19.3, Significantly improved Wi-Fi 6 Performance with RouterOS v7.19.3 (stable) Significantly improved Wi-Fi 6 Performance with RouterOS v7.19.3 (stable) If you've been waiting for a sign to explore MikroTik's Wi-Fi 6 solutions - this is it. With RouterOS v7.19.3, MikroTik has introduced significant improvements to 802.11ax (Wi-Fi 6) device performance. This update enhances range, stability, and overall wireless experience, making it the best time yet to deploy Wi-Fi 6 in your home, office, or enterprise setup. MikroTik is continuously working to improve AX performance across all supported MikroTik devices, and this update is a major step forward. Whether you're using a single AP or building a complex multi-device setup, you'll notice the difference. But there's more to this update: from enhanced IPv6 FastPath support to hardened RADIUS (RadSec) and smarter LTE/eSIM handling, the system is now more robust under real-world stress. For best results and security, always use the latest stable RouterOS version. Version 7.19.3 is currently our recommended release for anyone using Wi-Fi 6 hardware. #MikroTik#RouterOS#AlagasNet#LatestSoftware