@MV_Kpop · Post #6032 · 29.07.2020 г., 13:50
JUNE - Anywhere • 1080P HD #June@MV_Kpop
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
Пребарај: #june
@MV_Kpop · Post #6032 · 29.07.2020 г., 13:50
JUNE - Anywhere • 1080P HD #June@MV_Kpop
Hashtags
@mv_kpop · Post #4433 · 04.06.2019 г., 23:53
JUNE - Tonight • 1920x1080 Full HD #June@MV_Kpop
Hashtags
@apkpurechannel · Post #2500 · 23.06.2025 г., 11:33
🎈Hot Game This Week🎈 🗣🔥#Brawl Stars#June 2025 Brawl Talk 📌Next Update is expected to arrive on 7️⃣/2️⃣, with: 2 Brawlers 9 Hypercharges Trophy Road Rework ... 🎁And here's a FREEBIE gift for all Brawl Stars players: 👉Log in to redeem: 🔗Get your freebie on the Supercell Store Add @APKFreeDownloader_Bot to get any apk you want.
Hashtags
@Dailyrss · Post #13031 · 30.06.2025 г., 00:45
Wikipedia每日一图(#June 30, 2025)https://ift.tt/OqInaAz Eruption of Strokkur (Icelandic for "churn"), a fountain geyser located in the Haukadalur geothermal area, southwestern Iceland.. 了解更多 . #Wikipedia每日一图
Hashtags
@Dailyrss · Post #13030 · 29.06.2025 г., 00:45
Wikipedia每日一图(#June 29, 2025)https://ift.tt/e35AXMc High altar of the subsidiary church St. Peter and Paul in Lavant, East Tyrol, Austria. The center of the triptych depicts Saint Peter and Saint Paul flanking Mary Help of Christians. Today is the Feast of Saints Peter and Paul.. 了解更多 . #Wikipedia每日一图
Hashtags
@Dailyrss · Post #13029 · 28.06.2025 г., 00:45
Wikipedia每日一图(#June 28, 2025)https://ift.tt/wPqIuef MG PA-based racer with a 1300cc six-cylinder engine, in the historic paddock of the Nürburgring before closed boxes. The license plate is modified. Event: DAMC 05 Oldtimer Festival 2008.. 了解更多 . #Wikipedia每日一图
Hashtags
@Dailyrss · Post #13028 · 27.06.2025 г., 00:45
Wikipedia每日一图(#June 27, 2025)https://ift.tt/pxShWOw An image of the Sacred Heart of Jesus at the center of a rose window in Santa Ifigênia Church São Paulo, Brazil. Today is the Feast of the Sacred Heart in the Roman Catholic Church.. 了解更多 . #Wikipedia每日一图
Hashtags
@Dailyrss · Post #13027 · 26.06.2025 г., 00:45
Wikipedia每日一图(#June 26, 2025)https://ift.tt/w0EkBm5 Gimbap, a Korean dish made from cooked rice, vegetables, fish, and meat.. 了解更多 . #Wikipedia每日一图
Hashtags
@Dailyrss · Post #13026 · 25.06.2025 г., 00:45
Wikipedia每日一图(#June 25, 2025)https://ift.tt/wxFuJKD The former "Kaispeicher B", one of the oldest preserved warehouse structures in the Port of Hamburg, is now home to the International Maritime Museum Hamburg. The museum opened 17 years ago today, on June 25, 2008.. 了解更多 . #Wikipedia每日一图
Hashtags
@Dailyrss · Post #13025 · 24.06.2025 г., 00:45
Wikipedia每日一图(#June 24, 2025)https://ift.tt/DaKpknr Interior of old town hall in Göttingen, Lower Saxony, Germany.. 了解更多 . #Wikipedia每日一图
Hashtags
@Dailyrss · Post #13024 · 23.06.2025 г., 00:45
Wikipedia每日一图(#June 23, 2025)https://ift.tt/QmHinEV Functionalist tower of the Olympic Stadium in Helsinki, Finland, designed by Yrjö Lindegren and Toivo Jäntti.. 了解更多 . #Wikipedia每日一图
Hashtags
@Dailyrss · Post #13023 · 22.06.2025 г., 00:45
Wikipedia每日一图(#June 22, 2025)https://ift.tt/pjC3XlE This stained glass window located in the Basilica of St. James and St. Agnes, a church in Nysa, Poland, depicts angels adoring the sacred host and wine during an epiclesis to the Holy Spirit, represented as a dove. Today is the Feast of Corpus Christi, which is observed as a religious celebration in much of Western Christianity and as a public holiday in various nations.. 了解更多 . #Wikipedia每日一图
Hashtags