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

Резултати

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

Пребарај: #grupos

当前筛选 #grupos清除筛选
BiA Cerámica Fría

@biaceramicafria · Post #3856 · 30.11.2022 г., 17:34

🏆🙌 🍀❤️🥰⚠️💥🛒 🎊🏷️🪢✏️ Si tu respuesta es SÍ, ÚNETE a este grupo https://t.me/craftingtools que mañana damos inicio a diciembre con esta ✏️ ✏️ ✏️ ✏️ 🍀🙌🎰🎰🎰 🏆 1 Premio por valor superior a 40 MLC: 💙Set de cortadores de acero inoxidable 💙Set de mini cúter 💙4 cortadores de flor con sistema de expulsión 💙3 cortadores de estrellas 💙3 cortadores (oso, corazón y rosa) 💙200 cascabeles 💙Molde de silicona 💙100 Bases para aretes y 100 cierres de acero inoxidable 💙Set de 11 felpitas 💙1 tira de figuras de fomi 🏆🙌 🍀❤️🥰⚠️💥🛒 🎊🏷️🖇️🧿 #grupos

Hashtags

BiA Cerámica Fría

@biaceramicafria · Post #3621 · 20.06.2022 г., 13:50

‼️ Atención‼️ NUEVA 🅞🅕🅔🅡🅣🅐 de compra, esta vez en 𝐀𝐧𝐢𝐦𝐚𝐥𝐞𝐬 𝐒𝐚𝐥𝐮𝐝𝐚𝐛𝐥𝐞𝐬, para los peludos de casa, escamosos y plumíferos también 🐶🐱🐹🐟🦜 Compras por encargo del catálogo SheIn. Use este enlace para unirse👇 https://t.me/animalessaludables https://chat.whatsapp.com/DQf3jDayREZFmsgQe5fvJZ #grupos

Hashtags

BotsGram®

@botsgram_cu · Post #3626 · 11.03.2021 г., 00:53

¿Que puede hacer este bot? @GroupsMusicBot Este bot te permite reproducir música en tus grupos a través de los nuevos chats de voz introducidos recientemente por Telegram. ¡Simplemente agregue el bot en su grupo y lea la lista de comandos para descubrir cómo usarlo! Idioma: inglés (Visto en @botsgram_cu) #música#grupos

BotsGram®

@botsgram_cu · Post #4143 · 25.07.2021 г., 18:14

¿Que puede hacer este bot? @GooofyBot Este bot elimina todas las fotos de desnudos para que Telegram no prohíba tus grupos. Idiomas: inglés árabe (Visto en @botsgram_cu) #grupos#herramientas

BotsGram®

@botsgram_cu · Post #3686 · 19.03.2021 г., 01:40

¿Que puede hacer este bot? @famigliacounterbot Family Counter es el bot que puedes usar para contar los mensajes de tu grupo y competir con otros. ¡Agrégalo a tu grupo para que entre en acción de inmediato! Idioma: italiano (Visto en @botsgram_cu) #grupos#herramientas

BotsGram®

@botsgram_cu · Post #3107 · 02.11.2020 г., 19:01

¿Que puede hacer este bot? @matanet_bot Bot para cualquier chat. Elimina mensajes que contienen obscenidades, dejando un mensaje en el chat en el que educadamente pide no jurar. Agrega el bot a tu chat y dale permiso para eliminar mensajes. No se requieren ajustes adicionales. Idioma: ruso (Visto en @botsgram_cu) #herramientas#grupos

BiA Cerámica Fría

@biaceramicafria · Post #3662 · 20.07.2022 г., 16:28

Como cada miércoles... Llega un 👆This or That👇 Este no es la excepción y viene con una sorpresa 😍👉entérate de los detalles aquí 👈 y únete a nuestro canal de importaciones 🛍️Accesorios BiA con ropita bonita🛒 #grupos#encuesta#bia_recomienda

BotsGram®

@botsgram_cu · Post #4026 · 17.06.2021 г., 02:28

¿Que puede hacer este bot? @asamsgbot Este bot le permite enviar mensajes privados en chats públicos, los mensajes solo son visibles para el destinatario y el remitente. Sólo funciona de forma inline. Idiomas: español, inglés, italiano (Visto en @botsgram_cu) #mensajes#grupos

BotsGram®

@botsgram_cu · Post #3609 · 09.03.2021 г., 12:46

¿Que puede hacer este bot? @ThankStickerBot Envía una calcomanía de agradecimiento al grupo cuando alcanza "x" cantidad de miembros. Idioma: inglés (Visto en @botsgram_cu) #stickers#grupos

BotsGram®

@botsgram_cu · Post #4179 · 09.08.2021 г., 15:43

¿Que puede hacer este bot? @KattoRobot Bot de entretenimiento para grupos con comandos, tablas de clasificación y un sistema de puntos para mantener activo a tu grupo. Idiomas: italiano (Visto en @botsgram_cu) #entretenimiento#grupos

BotsGram®

@botsgram_cu · Post #3088 · 27.10.2020 г., 01:55

¿Que puede hacer este bot? @Membership_admin_bot Este bot te ayudará a monetizar tus grupos de telegram, crear grupos privados pagados y vender productos 💵 Puede aceptar pagos 📆 Crear suscripciones 🌐 Dale a tus clientes enlaces de invitación 📌 Enviar recordatorios ⛔️ Prohibir a los que no pagan 🛍Vender Productos Idioma inglés (Visto en @botsgram_cu) #membresía#grupos

BotsGram®

@botsgram_cu · Post #3860 · 30.04.2021 г., 23:25

¿Que puede hacer este bot? @FeaturesBugsBot Este bot le permite enviar nuevas Funciones e informar Errores de los usuarios del grupo. Los diversos informes se recibirán en un canal de registro. Idiomas: inglés, español, italiano, indonesio, árabe (Visto en @botsgram_cu) #herramientas#grupos#canales

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