@everything_science · Post #3448 · 11.05.2025 г., 18:14
Happy Mother's day to all the older siblings that had to put in the extra hand for being the oldest. #Celebrity
Hashtags
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
Пребарај: #celebrity
@everything_science · Post #3448 · 11.05.2025 г., 18:14
Happy Mother's day to all the older siblings that had to put in the extra hand for being the oldest. #Celebrity
Hashtags
@Beautiful_wallpaper · Post #2795 · 18.02.2024 г., 18:49
#Celebrity
Hashtags
@balinews · Post #24 · 25.04.2024 г., 10:25
👳♂️ Sadhguru flew to Bali to recuperate after an illness Where else could one meet India's most popular yogi and mystic if not in Ubud. Sadhguru went for a walk through the busy Balinese streets, surprising the islanders and visitors with his appearance. It was hard not to notice him, because he went on the tour not alone, but with a full delegation. These are the participants of the unique 10-day program "Mystical Reflections", with which he came to Bali. Bali brings tranquility and vigor for physical and spiritual recovery Sadhguru @BaliNews #celebrity#Ubud
Hashtags
@interesting_planet_facts · Post #432 · 26.07.2025 г., 22:22
🌎 Elvis Presley’s hair famously appeared jet-black, but he was actually born a natural blonde! He dyed his hair with shoe polish before becoming a music icon, giving him his signature look. ✨ #history⚡#music⚡#celebrity 👉subscribe Interesting Planet
Hashtags
@LovelyNature · Post #1479 · 03.05.2021 г., 12:52
Bollywood Celebrities switching to Vegetarianism - #Bollywood#Celebrity#Vegetarian#Animallovers - https://www.tellychakkar.com/movie/movie-news/b-town-cites-carbon-footprint-love-animals-among-reasons-green-diet-210502@lovelynature
@Kampf_fuer_unsere_Zukunft · Post #51454 · 18.03.2026 г., 21:25
❗💥 BREAKING NEWS💥❗ ELLEN GIVES AN APOLOGY SHIWS HOW SINCERE SHE IS ABOUT HER WHOLE LIFE???😳🤡🤨 No one will believe you... #celebrity#fyp#horror#apology#movie#Epstein TEILEN Folgt mir auf Telegram ↕️↕️↕️ https://t.me/Kampf_fuer_unsere_Zukunft Chat-Kanal ⬇️⬇️⬇️ https://t.me/IavYc2SRFdY1OGY6 TikTok https://www.tiktok.com/@danielarbogast0
@teasticker · Post #9197 · 06.02.2022 г., 04:00
People Memes 👍 #PeopleMemes#good#JimCarrey#famous#celebrity#animated #牛掰#金凯瑞#名人#明星#动画
@teasticker · Post #9821 · 03.06.2022 г., 06:00
Cute Girls 🙄 #CuteGirls#Kitty#kr#stars#celebrity#girls#portrait #韩国#明星#名人#女孩#肖像