@botsgram_cu · Post #4294 · 26.08.2021 г., 00:49
¿Que puede hacer este bot? @usetgbot Con este bot puedes buscar diferentes sitios web, directamente desde Telegram Idioma: inglés (Visto en @botsgram_cu) #búsqueda#web
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
Пребарај: #búsqueda
@botsgram_cu · Post #4294 · 26.08.2021 г., 00:49
¿Que puede hacer este bot? @usetgbot Con este bot puedes buscar diferentes sitios web, directamente desde Telegram Idioma: inglés (Visto en @botsgram_cu) #búsqueda#web
@botsgram_cu · Post #4331 · 05.09.2021 г., 13:25
¿Que puede hacer este bot? @GooGLeSearchBXBot Con este bot puedes realizar búsquedas en Google de forma inline Idiomas: inglés español (Visto en @botsgram_cu) #google#búsqueda
@botsgram_cu · Post #3747 · 31.03.2021 г., 15:07
¿Que puede hacer este bot? @ispicbot Bot inline para buscar imágenes sin salir de Telegram Idioma: inglés (Visto en @botsgram_cu) #fotos#imágenes#búsqueda
@botsgram_cu · Post #3894 · 14.05.2021 г., 01:28
¿Que puede hacer este bot? @podcastly_bot Encuentre nuevos podcasts por sistema de búsqueda o recomendación, envíe notificaciones sobre nuevos episodios. Idiomas: varios incluido español (Visto en @botsgram_cu) #podcasts#búsqueda
@botsgram_cu · Post #3866 · 04.05.2021 г., 13:01
¿Que puede hacer este bot? @threej_bot Busca canales, grupos, bots y cuestionarios disponibles en el directorio de threej. Idioma: inglés (Visto en @botsgram_cu) #búsqueda#directorio
Hashtags
@botsgram_cu · Post #4536 · 06.12.2021 г., 14:41
¿Que puede hacer este bot? @BrainQuoteBot Busque citas de personalidades famosas en la mayor base de datos de citas Idiomas: inglés (Visto en @botsgram_cu) #búsqueda#citas#quotes
@botsgram_cu · Post #4163 · 05.08.2021 г., 14:27
¿Que puede hacer este bot? @faffinitybot Este bot puede buscar información en FilmAffinity sobre películas, series, miniseries, cortos, documentales, etc. Idiomas: español, inglés (Visto en @botsgram_cu) #búsqueda#películas#seies#documentales
@botsgram_cu · Post #4499 · 20.11.2021 г., 16:11
¿Que puede hacer este bot? @SearchLocationnBot Bot para buscar ubicaciones en todo el mundo. Idiomas: inglés (Visto en @botsgram_cu) #localización#ubicación#búsqueda#latitud#longitud
@botsgram_cu · Post #4925 · 11.03.2024 г., 19:50
🤖 Nuevo bot 📋 Nombre: APKFreeDownloader_Bot 🆔 Nombre de usuario: @APKFreeDownloader_Bot ➖➖➖ ℹ️Descripción: ¡Este BOT te ayuda a descargar recursos raros para aplicaciones, juegos o mod apk de forma gratuita! 🌐 Idiomas: Inglés Ruso Español Árabe 💬 Soportes en línea: sí 👥 Grupos: si #️⃣ Etiquetas: #juego#aplicación#apk#android#descargar#búsqueda#enlínea