@borkena · Post #5895 · 01.03.2026 г., 05:36
የራያ ማንነት አስመላሽ ኮሚቴ ጋር የተደረገ ቃለ ምልልስ https://youtu.be/-0cPFDyO4vE?si=LVIFxNROa-Qg0zt9#raya#Tigray#Ethiopia#politics
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
Пребарај: #raya
@borkena · Post #5895 · 01.03.2026 г., 05:36
የራያ ማንነት አስመላሽ ኮሚቴ ጋር የተደረገ ቃለ ምልልስ https://youtu.be/-0cPFDyO4vE?si=LVIFxNROa-Qg0zt9#raya#Tigray#Ethiopia#politics
@borkena · Post #5671 · 01.01.2026 г., 15:15
Why the World Misunderstands Wolkait and Raya. Read more. https://borkena.com/2026/01/01/ethiopia-why-the-world-misunderstands-wolkait-and-raya/#Ethiopia#Wolkait#Raya#politics
@borkena · Post #5840 · 24.02.2026 г., 11:29
ከወሎ ራያ አማራ ማንነትና ወሰን አስመላሽ ኮሜቴ #Ethiopia#Wello#Raya#ዜና#HouseofFederation
@borkena · Post #5835 · 23.02.2026 г., 17:02
የፌደሬሽን ምክር ቤት በወልቃይት እና ራያ ጉዳይ ላይ ያሳለፈው ውሳኔ እና ያስከተለው ውዝግብ https://youtu.be/6-VMdjC00-s?si=WaToTw2UC25ZoUKO#Ethiopia#News#Wolkait#humera#Raya#Tigray#ዜና
@addisstandardeng · Post #21370 · 11.02.2026 г., 12:55
News: #Amhara security bureau alleges #TPLF, #Eritrea involvement in ongoing conflicts The Amhara Regional State Peace and Security Bureau has alleged that ongoing conflicts in the Amhara region and elsewhere in #Ethiopia are receiving what it described as “leadership and logistical support from #Mekelle and #Asmara,” referring to the Tigray People’s Liberation Front (TPLF) and Eritrean government. In a statement released yesterday, the bureau said the public “must understand the reality” that the fighting is not only against groups it characterized as “extremists” but also involves what it described as internal and external actors. The statement further alleged that a group seeking control over the areas of #Wolkait, #Telemt, and #Raya had assigned what it called a mission to “internal extremist forces” and was mobilizing them to advance that objective. According to the bureau, the strategy aims to create conflicts across various zones and districts to... Read more: https://addisstandard.com/?p=55148