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

Резултати

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

Пребарај: #espresso

当前筛选 #espresso清除筛选
Crypto Drop Club

@drop_cryptogo · Post #2242 · 08.01.2026 г., 09:39

🗣#Espresso: Wallet Linking Deadline for Kaito Participants Espresso is an EVM-compatible blockchain focused on Web3 scalability and privacy. The team has announced a deadline for Kaito Launchpad participants. If you took part in the sale via Kaito, you must link your wallet by 18 January. ✔ Wallet linking is available here This step is required to receive tokens at TGE. If the wallet is linked after the deadline, token distribution may be delayed or unavailable. Usually, after such snapshots, teams need several days to finalize data and prepare the token distribution. ✔ Also, do not forget to register for the airdrop. If expectations are correct, tokenomics and the airdrop registration deadline may be announced next week. ⏱ TGE is expected at the end of January. Crypto Drop Club 👉 SUBSCRIBE

Hashtags

Crypto Drop Club

@drop_cryptogo · Post #1851 · 06.06.2025 г., 20:08

🗣#Espresso: New Quest on Layer3 Espresso is an EVM-compatible blockchain focused on scaling and privacy for Web3. What to do: ✔ Head over to the website and connect your wallet ✔ Quiz answers: C | B | D ✔ Claim the cube on Arbitrum network ($0.25 fee) Extras: 🟠 Around 50k users have already completed all 7 previous quests 🟠 Don't forget to do the older ones here 🟠 One more quest is dropping on June 18 ☝️ Start trading on Bybit Crypto Drop Club 👉 SUBSCRIBE

Hashtags

Chollazo Exprés 🔥 Ofertas y Descuentos

@ChollazoExpres · Post #5362 · 29.12.2025 г., 16:30

💥Cafetera DeLonghi Dedica EC685.R Regala momentos especiales con un café excepcional ✅OFERTA: 141.33€ ❌ Antes: 219.99€ 💰Ahorras un 36%🔥 Prepara espresso y cappuccinos de forma sencilla y con un diseño elegante en ace 👉 Sorprende a tus seres queridos esta Navidad #cafetera#espresso#aceroinoxidable#ofertas#descuentos#hogar#navidad 🛰️Oferta publicada en Hogar