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

Резултати

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

Пребарај: #ageverification

当前筛选 #ageverification清除筛选
Libreware

@libreware · Post #1566 · 24.03.2026 г., 10:39

A systemd fork has set out as a fu*k you to age verification. Liberated systemd is a fork of mainline systemd started by Jeffrey Seathrún Sardina, a machine learning/AI researcher who apparently had enough of where things were heading. The project is straightforward about its purpose; strip out what it considers surveillance-enabling code, keep everything else intact, and stay in sync with upstream as it develops. https://itsfoss.com/news/systemd-fork-strips-out-age-verification/ @itsfoss_official #AgeVerification#SystemD

Libreware

@libreware · Post #1576 · 15.04.2026 г., 16:39

438 Experts Warn: Age Verification May Not Work | Tech, Privacy News Explained More than 400 security and privacy experts have issued a formal warning about age verification systems. Importantly, they are not arguing against protecting children online — but raising concerns about whether current systems actually work as intended, how they scale, and what risks they introduce. The warning comes as governments in the UK, US, and Europe continue rolling out age verification and age assurance requirements under new regulations. In this video, we look at: • Who these experts are • What they actually said • The technical challenges behind age verification • Why concerns about privacy, security, and effectiveness are being raised • And why these systems are being introduced anyway https://csa-scientist-open-letter.org/ageverif-Feb2026 #BigBrother#AgeVerification