@centralasian_greenuniversity · Post #401 · 30.11.2025 г., 07:45
#GreenUniversity#TITF2025#TourismFair#SustainableTourism#StudentExperience ✉️[email protected] ☎️ +998 55 512 00 77 📍Location 🌐Website | 📱Telegram | 📱Instagram | 📱LinkedIn | 🟥YouTube
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
Пребарај: #studentexperience
@centralasian_greenuniversity · Post #401 · 30.11.2025 г., 07:45
#GreenUniversity#TITF2025#TourismFair#SustainableTourism#StudentExperience ✉️[email protected] ☎️ +998 55 512 00 77 📍Location 🌐Website | 📱Telegram | 📱Instagram | 📱LinkedIn | 🟥YouTube
@centralasian_greenuniversity · Post #390 · 28.11.2025 г., 13:18
Green University Students at the Tashkent International Tourism Fair 2025 🖥Students of Green University are actively participating in the Tashkent International Tourism Fair, taking place on November 27–29, 2025 at CAEx, Tashkent. Our students are engaging with exhibitors, learning about sustainable tourism practices, and representing the university’s growing initiatives in environmental and climate education. #GreenUniversity#TITF2025#TourismFair#SustainableTourism#StudentExperience ✉️[email protected] ☎️ +998 55 512 00 77 📍Location 🌐Website | 📱Telegram | 📱Instagram | 📱LinkedIn | 🟥YouTube
@centralasian_greenuniversity · Post #376 · 28.11.2025 г., 06:25
Field Training at Shaykhantakhur District Criminal Court 🗣On November 25, 2025, active members of the Green University Legal Clinic took part in a special field training session at the Shaykhantakhur District Court for Criminal Cases. 🗣This initiative was organized by Valijonov Daler Dilshodovich, PhD, Associate Professor and Head of the Legal Clinic at Green University. 🗣During the visit, students observed real court proceedings, allowing them to strengthen their legal knowledge, develop practical skills, and connect classroom theory with real-world legal practice. #GreenUniversity#LegalClinic#StudentExperience#CourtPractice#EnvironmentalLaw#EducationInAction ✉️[email protected] ☎️ +998 55 512 00 77 📍Location 🌐Website | 📱Telegram | 📱Instagram | 📱LinkedIn | 🟥YouTube