TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #146 · 16 сеп.

Функция sub в regex может принимать функцию в качестве аргумента repl. 📄 Из документации: If repl is a function, it is called for every non-overlapping occurrence of pattern. The function takes a single match object argument, and returns the replacement string. То есть для каждого совпадения будет вызвана функция для вычисления замены вместо замены на одну и ту же строку для всех совпадений. Иными словами, для замены разных совпадений на разные строки не потребуется запускать re.sub() много раз для каждой строки замены. Достаточно определить функцию, которая вернёт строку для каждого из совпадений. Описание слишком запутанное🤔, давайте лучше рассмотрим на простом примере: Создаем карту замены. То есть какие строки на какие требуется менять. remap = { 'раз': '1', 'два': '2', 'три': '3', 'четыре': '4', 'пять': '5', } Пишем функцию поиска строки для замены. Единственным аргументом будет объект re.Match. Используя данные этого объекта мы вычисляем замену on-the-fly! def get_str(match: re.Match): word = match.group(1) return remap.get(word.lower()) or word Пример текста. text = '''Раз Два Три Четыре Пять Вместе будем мы считать Пять Четыре Три Два Раз Мы считать научим вас ''' Теперь запускаем re.sub и вместо строки замены (repl) подаём имя функции. (Данный паттерн ищет отдельные слова в тексте) >>> print(re.sub(r'(\w+)', get_str, text)) 1 2 3 4 5 Вместе будем мы считать 5 4 3 2 1 Мы считать научим вас Думаю, достаточно наглядно 🤓 #libs#regex

Hashtags

Резултати

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

Пребарај: #greenuniversity

当前筛选 #greenuniversity清除筛选
Green University CA | Official

@centralasian_greenuniversity · Post #461 · 05.12.2025 г., 05:17

December 5 - World Soil Day 🌳Today we celebrate World Soil Day, a global reminder of how important healthy soil is for food security, ecosystems, and our future. 🍀Let’s appreciate the ground beneath our feet — it sustains life more than we realize. #WorldSoilDay#GreenUniversity ✉️[email protected] ☎️ +998 55 512 00 77 📍Location 🌐Website | 📱Telegram | 📱Instagram | 📱LinkedIn | 🟥YouTube

Образование в Узбекистане

@obrazovanie_uzbekistan · Post #2872 · 11.07.2024 г., 13:00

🎓Приём в Green University ещё открыт!🌿 📚Степени бакалавра: Бакалавр (с отличием) Экологический и устойчивый менеджмент Бакалавр (с отличием) Окружающая среда и экономика Бакалавр (с отличием) Экология и государственное управление 🎓Магистерские степени: Магистр (с отличием) Экологическое право Магистр (с отличием) Экологические коммуникации Магистр (с отличием) Устойчивое развитие Магистр (с отличием) Устойчивые финансы 🔄Возможность перевода: продолжить обучение на 2-м курсе Green University Чтобы подать заявку или узнать критерии приема: 📧Электронная почта: [email protected] 📞Телефон: +998555120077 Подайте заявку прямо сейчас:https://greenuniversity.uz/en/apply/main Критерии поступления:https://greenuniversity.uz/en/apply/manual/admission-criteria Центрально-азиатский университет по изучению окружающей среды и изменения климата Green University Формируйте более зеленое будущее вместе с нами! 🌍 Telegram | Instagram #GreenUniversity#Admissions#Sustainability#TransferStudents

Green University CA | Official

@centralasian_greenuniversity · Post #315 · 09.11.2025 г., 09:04

📣Exciting news! 🗓This Tuesday, November 11, Dr. Anna Ubaydullaeva — lecturer at GREEN University, Tashkent, will give a seminar in Rome, Italy (RomaTre) on “Climate Change Law and Sustainable Development in Central Asia: Lessons and Perspectives from Uzbekistan.” 🔜A great opportunity to share Uzbekistan’s experience and vision on climate sustainability with the international community! 🇺🇿🤝🇮🇹 #GREENUniversity#Uzbekistan#ClimateAction#Sustainability ✉️[email protected] ☎️ +998 55 512 00 77 📍Location 🌐Website | 📱Telegram | 📱Instagram | 📱LinkedIn | 🟥YouTube

Green University CA | Official

@centralasian_greenuniversity · Post #1073 · 17.04.2026 г., 10:20

Green University Organized “Youth Day” Events On April 16, in celebration of Youth Day, Green University organized a series of events covering various areas for students and young people. 🖥The program included psychological consultations, English language classes, sports competitions, and the “Zakovat” intellectual game. In addition, a preventive awareness session with representatives of the internal affairs bodies was held, followed by an open Q&A session on legal topics. #GreenUniversity#YouthDay#StudentLeague 👉ReadMore ___________________ Green University’da “Yoshlar kuni” tadbirlari o‘tkazildi 16-aprel “Yoshlar kuni” munosabati bilan Green University’da talabalar va yoshlar uchun turli yo‘nalishlarni qamrab olgan tadbirlar tashkil etildi. 🖥Dastur doirasida psixologik konsultatsiyalar, ingliz tili mashg‘ulotlari, sport musobaqalari hamda “Zakovat” intellektual o‘yini o‘tkazildi. Shuningdek, ichki ishlar organlari vakillari ishtirokida profilaktik uchrashuv va huquqiy mavzudagi ochiq savol-javob sessiyasi tashkil etildi. #GreenUniversity#YoshlarKuni 👉Batafsil ✉️[email protected] ☎️ +998 55 512 00 77 📍Location 🌐Website | 📱Telegram | 📱Instagram | 📱LinkedIn | 🟥YouTube

Green University CA | Official

@centralasian_greenuniversity · Post #670 · 28.01.2026 г., 04:54

January 28 — International Reducing CO₂ Emissions Day 📸👩‍🏫👨‍🏫Every action counts! Today is a reminder that students are not just learners, but future leaders of a more sustainable world. ✔️From saving energy and choosing public transport to supporting green innovations, small daily choices can make a big difference for our planet. 🔼Let’s work together for cleaner air, a healthier environment, and a greener future. The change starts with us. #GreenUniversity#ClimateAction#CO2Reduction#SustainableFuture ✉️[email protected] ☎️ +998 55 512 00 77 📍Location 🌐Website | 📱Telegram | 📱Instagram | 📱LinkedIn | 🟥YouTube

Green University CA | Official

@centralasian_greenuniversity · Post #481 · 05.12.2025 г., 12:26

Law and Ecology Roundtable at Green University 🗓On December 4, 2025, Green University held a high-level Roundtable on Law and Ecology bringing together researchers from leading international institutions to discuss pressing issues at the intersection of environmental governance, ecological transition, and sustainable development. The roundtable featured four expert presentations: 🟠Pauline Couteau (Sciences Po) – introducing the role and research initiatives of Sciences Po in the field of environmental studies; 🟠Dr. Álvaro Artigas Pereira (Sciences Po) – delivering insights on “Confronting Policies to Complexity: Policy Capacity and Development in Shifting Times”; 🟠Tom Wassenaar (CIRAD) – discussing environmental risks and territorial approaches; 🟠Prof. Bénédicte Cenki (University of Montpellier) – presenting on the challenges of mineral resources and the ecological transition, and how to balance energy demands with environmental protection. 🟡The session concluded with an open discussion, allowing students and researchers to engage directly with the speakers. #GreenUniversity#LawAndEcology#ClimateAction#SustainableDevelopment ✉️[email protected] ☎️ +998 55 512 00 77 📍Location 🌐Website | 📱Telegram | 📱Instagram | 📱LinkedIn | 🟥YouTube

Green University CA | Official

@centralasian_greenuniversity · Post #36 · 09.07.2024 г., 04:54

🎓Green University Admissions Still Open!🌿 Join our cutting-edge programs: 📚Bachelor's Degrees: BSc (Hons) Environmental and Sustainable Management BSc (Hons) Environment and Economics BSc (Hons) Ecology and Public Administration 🎓Master's Degrees: MSc (Hons) Environmental Law MSc (Hons) Environmental Communication MSc (Hons) Sustainable Development MSc (Hons) Sustainable Finance 🔄 Transfer Opportunity: Continue in 2nd year at Green University! To apply or for admission criteria: 📧 Email: [email protected] 📞 Call: +99855 512 00 77 Apply now:https://greenuniversity.uz/en/apply/main Admission criteria:https://greenuniversity.uz/en/apply/manual/admission-criteria Shape a greener future with us!🌍 #GreenUniversity#Admissions#Sustainability#TransferStudents

Green University CA | Official

@centralasian_greenuniversity · Post #494 · 09.12.2025 г., 04:43

📸 Highlights from the Experience Sharing Network #GreenUniversity#ExperienceSharingNetwork#Sustainability#YouthLeadership ✉️[email protected] ☎️ +998 55 512 00 77 📍Location 🌐Website | 📱Telegram | 📱Instagram | 📱LinkedIn | 🟥YouTube

Green University CA | Official

@centralasian_greenuniversity · Post #344 · 13.11.2025 г., 07:44

Healthy Planet, Healthy You! ❗️Informative signs on “General Rules and Environmental Protection: Healthy Eating Habits” have been placed around the campus by psychologist Muslima Nabijonova and tutor Shokhrukh Obidov — reminding everyone that caring for nature starts with caring for ourselves #GreenUniversity#EcoLifestyle#HealthyEating#Sustainability ✉️[email protected] ☎️ +998 55 512 00 77 📍Location 🌐Website | 📱Telegram | 📱Instagram | 📱LinkedIn | 🟥YouTube

123•••56
ПретходнаСтраница 1 од 6Следна