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

Резултати

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

Пребарај: #captions

当前筛选 #captions清除筛选
#️⃣Hashtag | Rasmiy kanal

@HashtagUz · Post #13787 · 14.03.2025 г., 03:28

⚠️ Blogerlar uchun YANGILIK: Captions kompaniyasi yangi Mirage texnologiyasini taqdim etdi. Neyron tarmoq noldan odamlarni yaratadi va ovozni video formatiga maksimal aniq oʻgiradi. 😱 Bu haqiqiy inqilob! Boshqa modellar faqat lablarni harakatlantirsa, Mirage hammasini qiladi: ✅ Tana modelini yaratadi ✅ Haqiqiydan ajratib bo'lmaydigan harakatlar ✅ Fon ✅ Tabiiy mimika ➡️https://www.captions.ai/mirage ➡️#ai#captions | Birinchi raqamli IT-Blog

Hashtags

☀️Beck’s☀️

@beck_blog · Post #998 · 02.01.2021 г., 23:00

· · • • • •❄️• · · INSTAGRAM · · •❄️• • • • · · Escribir captions en Instagram es un arte y es una excelente manera de impulsar el compromiso por parte de tu comunidad. Tus descripciones son representaciones de tu marca. Y podrían ser la última pieza que necesitas mejorar para pasar de un feed bueno a uno profesional. De hecho, escribir captions en Instagram podría ser la clave para que tu publicación gane visibilidad. Así que lee estos Tips para escribir captions en Instagram y luego me cuentas que te parecen 😉. #tips_instagram #captions · · • • • • • · · · · • • • ☃️• • • · · · · • • • • • · ·

☀️Beck’s☀️

@beck_blog · Post #2025 · 20.05.2021 г., 20:05

· · • • • •🌼• · · INSTAGRAM · · •🌼• • • • · · Uno de los beneficios de los posts en Instagram es que puedes cargar fotografías, diseños, videos e incluso galerías de hasta 10 imágenes juntas. En este caso la clave es que lo que sea que uses como portada sea lo suficientemente atractivo para que los usuarios se detengan a leer tu caption. #tips_instagram #captions#consejos · · • • • • • · · · · • • • 🍃• • • · · · · • • • • • · ·

GitHub Trends

@githubtrending · Post #14817 · 11.06.2025 г., 11:30

#python#asr#captions#cli#python#subtitle#subtitles#transcript#transcripts#translating_transcripts#youtube#youtube_api#youtube_asr#youtube_captions#youtube_subtitles#youtube_transcript#youtube_transcripts#youtube_video The YouTube Transcript API is a tool that helps you get the text from YouTube videos. It's fast and easy to use, saving you time compared to watching the whole video. You can use it to make subtitles, translate text, and even analyze what's being said in videos. This is helpful for content creators who want to make their videos more accessible and for researchers who need to study video content quickly. It also supports multiple languages, making it useful for a wide range of users. https://github.com/jdepoix/youtube-transcript-api

☀️Beck’s☀️

@beck_blog · Post #2742 · 22.09.2021 г., 13:13

┏━━━━━°❀•°:🍂 - 🍂:°•❀°━━━━━┓ POR AQUÍ PUEDE NAVEGAR POR EL CANAL 📁|#inicio 📝|#tips_instagram 📸|#tips_fotografía 📲|#instagram_Stories ⚙️|#estadísticas_instagram #️⃣|#hashtags 📱|#feed 📋|#captions 💡|#ideas 📷|#fotos 🏷|#peticiones ✨|#especial 📖|#recomendación 🧖🏻‍♀️|#cuidado_personal 💭|#consejos 🔎|#remedios 🧼|#limpieza 🖼|#fondos 🤯|#curiosidades 📒|#idiomas 🧁|#receta ☕️|#café 🎉|#festivos 🎃|#halloween 🎄|#navidad 👫🏻|#SanValentin 🍁|══════◄••❀••►══════|🍁 ➳ Recuerde que puede escribirme a ⇢ @SoyBeck_bot Para enviarme sugerencias, dudas, aportes o alguna petición especial que deseen ☺️ ┗━━━━━°❀•°:🍂 - 🍂:°•❀°━━━━━┛