@Wallpaper_INT · Post #46177 · 03.05.2025 г., 04:30
#Girl#Mask#Symbols#8K @Wallpaper_INT
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
Пребарај: #symbols
@Wallpaper_INT · Post #46177 · 03.05.2025 г., 04:30
#Girl#Mask#Symbols#8K @Wallpaper_INT
@amazingeo · Post #452 · 13.11.2025 г., 20:31
🌍 The only country whose official flag features a full map is Cyprus. The flag shows the island’s outline in gold above two green olive branches, symbolizing peace and unity. ✨ #cartography⚡#maps⚡#symbols⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels
@googlefactss · Post #40514 · 09.01.2026 г., 23:03
Tying a knot in a handkerchief helps people remember things, like using symbols. Both work because they connect to what someone does in real life. 🧠🤧 [Read more] What do you do or use to remember things? @googlefactss#MemoryHelp#Symbols#MindFacts
Hashtags
@googlefactss · Post #40564 · 21.01.2026 г., 05:01
The flag of Quebec is blue with a white cross and four white fleur-de-lis. It was officially adopted on January 21, 1948. The blue means the sky, the white cross means faith, and the fleur-de-lis are old French symbols. The flag is a reference to Quebec’s French history and culture. 🇨🇦✝️⚜️ [Read more] @googlefactss#Quebec#Flag#History#Symbols
@redfoxuz · Post #1297 · 20.10.2020 г., 20:37
Tipografika: 2-qism Tipografika boʻyicha qisqa eslatmalar. #typography#basics#time#values#notes#symbols#digits#numbers#names Instagram • Dribbble • YouTube • Telegram