@YukiPhotoCollection · Post #546 · 21.12.2018 г., 06:25
#Remhttp://www.pixiv.net/member_illust.php?mode=medium&illust_id=60107707
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
Пребарај: #rem
@YukiPhotoCollection · Post #546 · 21.12.2018 г., 06:25
#Remhttp://www.pixiv.net/member_illust.php?mode=medium&illust_id=60107707
Hashtags
@re_pics · Post #8244 · 01.04.2024 г., 00:18
━━━━━━━━🔮🔮━━━━━━━ #wallpaper#Rem 🔰ᐈCharacter: Rem 🔰ᐈSource: Re:Zero 『 @Re_pics 』 ━━━━━━━━🔰🔰━━━━━━━━
Hashtags
@re_pics · Post #8242 · 01.04.2024 г., 00:18
━━━━━━━━🔮🔮━━━━━━━ #wallpaper#Rem 🔰ᐈCharacter: Rem 🔰ᐈSource: Re:Zero 『 @Re_pics 』 ━━━━━━━━🔰🔰━━━━━━━━
Hashtags
@re_pics · Post #8240 · 01.04.2024 г., 00:18
━━━━━━━━🔮🔮━━━━━━━ #wallpaper#Rem 🔰ᐈCharacter: Rem 🔰ᐈSource: Re:Zero 『 @Re_pics 』 ━━━━━━━━🔰🔰━━━━━━━━
Hashtags
@ryuzuxhii · Post #30019 · 30.04.2026 г., 06:44
#Dipansh_00 #Rem
Hashtags
@RedOtaku · Post #278 · 01.03.2018 г., 18:19
#Wallpaper#Rem#ReZero
Hashtags
@YukiPhotoCollection · Post #550 · 22.12.2018 г., 16:06
#Rem#Ramhttp://www.pixiv.net/member_illust.php?mode=medium&illust_id=61258301
@cosplayuploadtest2 · Post #101808 · 23.03.2025 г., 02:41
Title: PuyPuyChan___Rem_Wedding Authors: #None Tags: #None#PuyPuyChan #_ #Rem#Wedding recommendation: None TelegraphLinks:page-0-25
Hashtags
@wall_amv · Post #8831 · 29.04.2024 г., 09:40
#anime #art #Re_zero #Emilia #Rem #Fan_Art #Girl #AnimWorld @Wall_Amv
@figuronyan · Post #107 · 03.05.2024 г., 19:27
#Rem#Re_Zero_kara_Hajimeru_Isekai_Seikatsu#noodle_stopper#noodle Я люблю Эмилию
@figuronyan · Post #114 · 03.05.2024 г., 19:44
#Rem#Re_Zero_kara_Hajimeru_Isekai_Seikatsu#bunny#b_style
@raremet2026 · Post #65 · 24.04.2026 г., 12:50
🌏Almost 600 participants from 19 countries have registered for the RAREMET-2026 Congress We are publishing the latest information about registration for the International Congress on Rare Metals, Materials and Technologies, which will be held in Moscow from May 20 to 22. 📊Participants from 19 countries worldwide: Russia, India, China, Kazakhstan, Republic of Korea, Mongolia, Cuba, Egypt, Belarus, Tajikistan, Uzbekistan, Pakistan, Vietnam, Bangladesh, Armenia, Iran, Malaysia, Singapore, South Africa. The largest delegation is from India. 🎓High scientific status: – 3 academicians and 11 corresponding members of the Russian Academy of Sciences - more than 50 professors, 64 doctors of sciences, 133 candidates of sciences 👩🔬Support for young researchers: – more than 220 young scientists under the age of 35 📌The Congress includes four thematic conferences (RAREMET:Minerals, RAREMET:Metallurgy, RAREMET:Chemistry, RAREMET:Functional), round tables, as well as an expert session on fire and explosion safety 🏭 The RAREMET:Expo exhibition will be held as part of the Congress, intergovernmental meetings (G2G) and a press-conference are also planned. 📖 The full text of the news is available on the Congress website. 🗓 RAREMET-2026 will be held on May 20-22 in Moscow at the RTU MIREA. The organizer is Giredmet JSC. 🌐 Website of the Congress: redmet.giredmet.ru 📱MAX: max.ru/id7707072637_gos22 See you at the key forum of the rare metal industry! #RAREMET2026#RAREMET2026#RareMetals#REM#technologicalsovereignty#RAREMETExpo