TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #65 · 8 апр.

Небольшой трик с регулярными выражениями который редко вижу в чужом коде. Допустим, вам нужно распарсить простой текст и вытащить оттуда пары имя+телефон. Вернуть всё это надо в виде списка словарей. Возьмем очень простой пример текста. >>> text = ''' >>> Alex:8999123456 >>> Mike:+799987654 >>> Oleg:+344456789 >>> ''' Соответственно, для выделения нужных элементов будем использовать группы. Получится такой паттерн: (\w+):([\d+]+) Как мы будем формировать словарь из найденных групп? >>> import re >>> results = [] >>> for match in re.finditer(r"(\w+):([\d+]+)", text): >>> results.append({ >>> "name": match.group(1), >>> "phone": match.group(2) >>> }) >>> print(results) [{'name': 'Alex', 'phone': '8999123456'}, ...] Можно немного сократить запись используя zip >>> results = [] >>> for match in re.finditer(r"(\w+):([\d+]+)", text): >>> results.append(dict(zip(['name', 'phone'], match.groups()))) Но есть способ лучше! Это именованные группы в regex. Можно в паттерне указать имя группы и результат сразу забрать в виде словаря. >>> for match in re.finditer(r"(?P<name>\w+):(?P<phone>[\d+]+)", text): >>> results.append(match.groupdict()) То есть всё что я сделал, это добавил в начале группы (внутри сбокочек) такую запись: (?P<group-name>...) Теперь найденная группа имеет имя и можно обратиться к ней как к элементу списка >>> name = match['name'] Либо забрать сразу весь словарь методом groupdict() >>> match.groupdict() #tricks#regex

Резултати

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

Пребарај: #herramienta

当前筛选 #herramienta清除筛选
BotsGram®

@botsgram_cu · Post #5063 · 28.12.2024 г., 01:38

¿Que puede hacer este bot? 🤖@siteshot_bot 📎El bot crea capturas de pantalla web Envía un enlace web y obtén una captura de pantalla de la página. • comprobar enlaces sospechosos (iploggers, sitios web de phishing, estafadores, etc.) • el bot se puede agregar a grupos #Herramienta ( Visto en: @BotsGram_Cu )

Hashtags

BotsGram®

@botsgram_cu · Post #5060 · 27.12.2024 г., 00:58

¿Qué puede hacer este bot? 🤖@ooSearchBot 📎Este bot es una extensión del motor de búsqueda nativo de Telegram. Aquí puedes buscar grupos, canales y bots activos de Telegram. Cada búsqueda te dará hasta 10 000 enlaces. Incluso puedes buscar enlaces privados y publicaciones de mensajes de Telegram. Envíame cualquier palabra clave que te interese y ¡pruébalo ahora! #Herramienta 📌Opinión personal: Una vez que lo uses, no volverás a usar el buscador nativo de Telegram. 10/10⭐️ ( Visto en: @BotsGram_Cu )

Hashtags

BotsGram®

@botsgram_cu · Post #5159 · 29.01.2025 г., 22:38

¿Que puede hacer este bot? 🤖@BHButtons_bot 📎Bot utilizado para crear publicaciones con todo tipo de botones y compartirlas en canales o grupos. También funciona en línea. Soporta texto y multimedia. #Herramienta#Edición ( Visto en: @BotsGram_Cu )

BotsGram®

@botsgram_cu · Post #5066 · 28.12.2024 г., 22:45

¿Que puede hacer este bot? 🤖@ImageResizerNewBot 📎Cambia el tamaño de las imágenes para alcanzar el tamaño de archivo o imagen deseado. #Herramienta#Edición ( Visto en: @BotsGram_Cu )

BotsGram®

@botsgram_cu · Post #5556 · 15.08.2025 г., 14:27

¿Qué puede hacer este bot? 🤖@BajarVideosBot 📎 Este es un potente bot para descargar videos de diferentes plataformas ▪️Sitios soportados: Youtube.com Facebook.com (Cuentas Publicas) TikTok.com Twitter.com Vimeo.comPinterest.com Otros Sitios #Herramienta#Descargar ( Visto en: @BotsGram_Cu )

BotsGram®

@botsgram_cu · Post #5161 · 29.01.2025 г., 22:38

¿Que puede hacer este bot? 🤖@ttloaderbot 📎El bot descarga vídeos de TikTok en la mejor calidad y sin marca de agua. #Descargar#Herramienta ( Visto en: @BotsGram_Cu )

BotsGram®

@botsgram_cu · Post #5145 · 23.01.2025 г., 23:57

¿Que puede hacer este bot? 🤖@VideoDownloadBot 📎El bot te permite descargar vídeos de TikTok, YouTube, VK, Instagram, Twitter y de otros 700 sitios. #Descargar#Herramienta ( Visto en: @BotsGram_Cu )

BotsGram®

@botsgram_cu · Post #5109 · 10.01.2025 г., 19:31

¿Que puede hacer este bot? 🤖@YtbDownBot 📎Soy YTBdownbot . Puedo descargar videos de YouTube y TikTok . El bot funciona directamente y en los chats . Agrega el bot a un grupo, luego envía el enlace del video y el bot enviará el video al chat. #Descargar#Herramienta ( Visto en: @BotsGram_Cu )

BotsGram®

@botsgram_cu · Post #5082 · 01.01.2025 г., 22:15

¿Que puede hacer este bot? 🤖@TGStoryXBot 📎Puede descargar fácilmente historias de Telegram y publicaciones archivadas de cualquier usuario en alta calidad y velocidad a través de su enlace. #Descargar#Herramienta ( Visto en: @BotsGram_Cu )

BotsGram®

@botsgram_cu · Post #5075 · 30.12.2024 г., 22:25

¿Que puede hacer este bot? 🤖@Kitefileupbot 📎Con este bot podrás descargar contenido de múltiples sitios en varios formatos y escucharlo en cualquier momento sitios web compatibles: (youtube, instagram, facebook, twitter, tiktok, likee, pinterest, snapchat). #Descargar#Herramienta ( Visto en: @BotsGram_Cu )

BotsGram®

@botsgram_cu · Post #5073 · 30.12.2024 г., 22:25

¿Que puede hacer este bot? 🤖@instaAnalysisBot 📎El bot te enviará historias de los usuarios que sigues en Instagram. Sin una VPN, de forma anónima, todas las publicaciones permanecerán en tu chat y podrás volver a ellas en cualquier momento. #Instagram#Herramienta ( Visto en: @BotsGram_Cu )

BotsGram®

@botsgram_cu · Post #5044 · 23.12.2024 г., 23:02

🤖@Pdot_ru_bot 📎chatbot GPT gratuito Características del robot: ✅ genera fotos y videos ✅ escribe códigos, textos, compone poesía ✅ trabaja con documentos ✅ reconoce lo que hay en la imagen Desarrollado por GPT-4o y DALLE #IA#Herramienta ( Visto en: @BotsGram_Cu )

ПретходнаСтраница 1 од 3Следна