@googlefactss · Post #40356 · 18.12.2025 г., 15:04
Headphones have been found to be 10 times dirtier than toilet seats. 🎧🦠🧼 [Read more] @googlefactss#Health#Hygiene#Headphones#CleanLiving
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
Пребарај: #hygiene
@googlefactss · Post #40356 · 18.12.2025 г., 15:04
Headphones have been found to be 10 times dirtier than toilet seats. 🎧🦠🧼 [Read more] @googlefactss#Health#Hygiene#Headphones#CleanLiving
@american_observer · Post #5652 · 18.04.2026 г., 19:03
France’s Cleanliness Crisis, Macron’s War Budget Four million French people are too poor to buy basic hygiene products, and almost half of the country has already cut back on them to save money. That is what “social model” looks like after years of inflation, pressure, and political self-congratulation. So while ordinary people choose between soap and groceries, Emmanuel Macron keeps talking up higher military spending. Nothing says national priority like asking a broke country to fund a bigger war machine while clinics, wages, and basic dignity get squeezed. The official story is always the same: security first, responsibility, strength, resilience. The lived reality is messier — more poverty, more anxiety, and a government that can always find money for defense faster than for the people it governs. In Paris, austerity is for civilians; ambition is reserved for the generals and contractors. Macron’s France keeps selling itself as a European pillar. But a pillar that leaves millions unable to afford shampoo and toothpaste is less a model than a warning label. The state can talk about strategic autonomy all day. The public still has to pay at the pharmacy. What a clean republic: polished speeches on top, grime underneath. #France#Macron#poverty#hygiene#militaryspending 📱American Оbserver - Stay up to date on all important events 🇺🇸