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

TGINSIGHT SIMILAR POSTS

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

Изворен канал @pythonotes · Post #83 · 11 мај

У строки в Python есть два очень похожих метода. На столько похожих что кажется они делают одно и тоже. Это метод isdigit() и isnumeric() Давайте посмотрим зачем нам два одинаковых метода? И так ли они одинаковы? Очевидно что isdigit() говорит нам, состоит ли строка только из чисел 0-9 >>> '12'.isdigit() True >>> '12x'.isdigit() False >>> '-12'.isdigit() False >>> '12.5'.isdigit() False Можно предположить что isnumeric() делает более глубокий анализ и распознаёт в строке float или отрицательное число. >>> '15'.isnumeric() True >>> '-15'.isnumeric() False >>> '15.2'.isnumeric() False Нет, всё так же как и с другим методом. В чем же тогда разница? Для начала посмотрим следующие примеры: >>> '5'.isdigit(), '5'.isnumeric() # Обычная цифра 5 # True, True >>> '꧕'.isdigit(), '꧕'.isnumeric() # Яванская 5 # True, True >>> '෩'.isdigit(), '෩'.isnumeric() # Синхала 3 # True, True >>> '৩'.isdigit(), '৩'.isnumeric() # Бенгальская 3 # True, True >>> '༣'.isdigit(), '༣'.isnumeric() # Тибетская 3 # True, True >>> '³'.isdigit(), '³'.isnumeric() # 3 верхний индекс (степень) # True, True >>> '𝟝'.isdigit(), '𝟝'.isnumeric() # Математическая двойная 5 # True, True >>> '๔'.isdigit(), '๔'.isnumeric() # Тайская 4 # True, True >>> '➑'.isdigit(), '➑'.isnumeric() # 8 в круге # True, True А теперь примеры в которых, по мнению Python, результаты не равны >>> '¾'.isdigit(), '¾'.isnumeric() # дробь три четверти # False, True >>> '⅕'.isdigit(), '⅕'.isnumeric() # дробь одна пятая # False, True >>> '𒐶'.isdigit(), '𒐶'.isnumeric() # клинопись 3 # False, True >>> '三'.isdigit(), '三'.isnumeric() # 3 из унифицированной идеограммы # False, True >>> '⑩'.isdigit(), '⑩'.isnumeric() # цифра 10 в круге # False, True >>> 'Ⅳ'.isdigit(), 'Ⅳ'.isnumeric() # Римская 4 # False, True >>> '𑇪'.isdigit(), '𑇪'.isnumeric() # Сенегальская архаическая 10 # False, True >>> '𐌢'.isdigit(), '𐌢'.isnumeric() # Этрусская цифра 10 # False, True >>> 'ↂ'.isdigit(), 'ↂ'.isnumeric() # Римская цифра 10000 # False, True >>> '〇'.isdigit(), '〇'.isnumeric() # Символ ККЯ ноль # False, True Получается, что isdigit() говорит нам, является ли символ десятичной цифрой или спецсимволом, имеющим цифирное значение после преобразования. В свою очередь isnumeric() включает все дополнительные символы юникода которые имеют отношения к числовым и цифровым представлениям. Ну и пара примеров в которых в обоих случаях символ не является числом, это эмодзи. >>> '🕙'.isdigit(), '🕙'.isnumeric() # эмодзи 10 часов # False, False >>> '7️⃣'.isdigit(), '7️⃣'.isnumeric() # эмодзи 7 # False, False Также есть еще один дополнительный и весьма полезный метод isdecimal(). Он нам сообщает, можно ли из указанного символа сделать простую десятичную цифру. То есть сработает ли метод int(x) >>> '෩'.isdecimal(), int('෩') # Синхала 3 # True, 3 >>> '➑'.isdecimal(), int('➑') # 8 в круге # False, ValueError Какие выводы? 🔸 При определении цифры в строке isdigit() подходит лучше чем isnumeric(), но оба не гарантируют успешную конвертацию в int 🔸 Для однозначного определения возможности преобразования строки в int лучше подходит метод isdecimal() 🔸 Для однозначного определения символов 0...9 лучше использовать regex Полный список символов юникода которые определяются как numeric #basic

Hashtags

Резултати

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

Пребарај: #descargar

当前筛选 #descargar清除筛选
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 #5108 · 10.01.2025 г., 19:31

¿Que puede hacer este bot? 🤖@downloadStickersBot 📎Descargador de stickers, descarga cualquier stickers de Telegram #Sticker#Descargar ( Visto en: @BotsGram_Cu )

BotsGram®

@botsgram_cu · Post #5088 · 03.01.2025 г., 22:31

¿Que puede hacer este bot? 🤖@InstagramDlPro_Bot 📎Puedo descargar fotos, videos, reels, Albums, Tv y stories de instagram si es publico, solo mandame el link aqui. También puedo trabajar en canales, solo necesitas enviar ese enlace y yo enviaré la publicación y eliminaré ese enlace. #Descargar#Instagram#Herramienta ( Visto en: @BotsGram_Cu )

BotsGram®

@botsgram_cu · Post #5005 · 06.06.2024 г., 02:03

🤖Nuevo bot 📋 Nombre: SpotSeekBot 🆔 Nombre de usuario: @SpotSeekBot ⭐️ Calificación: ⭐️⭐️⭐️⭐️ (4.7/5 de 340 votos) ———————————————————— ℹ️Descripción: Descarga tu música preferida de Spotify temas sueltos, albums o playlists. 🌐 Idiomas: inglés 💬 Soporta en línea: No 👥 Grupos: si #️⃣ Etiquetas: #descargar#música#Spotify

BotsGram®

@botsgram_cu · Post #4887 · 20.10.2022 г., 23:39

¿Que puede hacer este bot? @mysterious_uploader_robot •Cargador de URL •Cargar varios tipos de formatos •Descargar enlaces de más de 2 GB •Enlaces directo y los sube a Telegram como un archivo/video. Idioma : Inglés #upload#descargar#download ( Visto en: @BotsGram_Cu )

BotsGram®

@botsgram_cu · Post #4504 · 20.11.2021 г., 16:33

@Instatoolsbot ¿Qué puede hacer este bot? Con este bot puede descargar reels, publicaciones, videos, historias, IGTV y más de Instagram. Idiomas: Inglés y árabe Nota: Es importante usar Telegram Direct para acceder a este bot. (Visto en @BotsGram_cu) #instagram#medios#descargar

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