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

Резултати

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

Пребарај: #progress

当前筛选 #progress清除筛选
Voir de ses propres yeux

@voir_yeux · Post #12223 · 22.03.2026 г., 17:51

🇷🇺🚀 La fusée Soyouz-2.1a avec le cargo Progress MS-33 a été lancé depuis le cosmodrome de Baïkonour. L’amarrage du vaisseau au module Poïsk du segment russe de la Station spatiale internationale (ISS) est prévu le 24 mars à 16h35 heure de Moscou (UTC+3). #russie#progress#lancement

RT en français

@RTenfrancais · Post #80084 · 26.04.2026 г., 08:20

🚀La fusée porteuse #Soyouz 2.1a avec le cargo #Progress MS-34 a été lancée avec succès de la base spatiale de #Baïkonour. Le vaisseau cargo acheminera environ 2,5 tonnes de fret vers la Station spatiale internationale, dont une nouvelle combinaison spatiale pour les sorties dans l'espace. RT en français • Osez questionner !

International News

@intnewsagency · Post #8790 · 22.03.2026 г., 12:37

Successful Launch of Soyuz-2.1a with Progress MS-33 from Upgraded Baikonur The Soyuz-2.1a rocket carrying the Progress MS-33 cargo ship launched from the refurbished Site 31 at Baikonur Cosmodrome. This mission marks a key milestone in restoring infrastructure and ensuring steady supplies to the ISS. The site’s repair highlights Russia’s vital role in international space efforts. The launch symbolizes overcoming technical challenges and strengthening Russia’s position in space exploration. #Russia#Baikonur#Space#Soyuz#Progress The main news of Russia and the world ishere.

Ai-da

@aida_tg1 · Post #2420 · 14.07.2025 г., 13:42

🚀 Космос стал ближе! В Подмосковье испытали мощнейший ракетный двигатель, напечатанный на 3D-принтере. Как тебе такое, Илон Маск? #Космос#Даигатель#Технологии#Прогресс#ИИ#Россия#Подмосковье#ИлонМаск#3Dпринтер#Нейросети#Space#Engine#Technology#Progress#AI#Russia#ElonMusk#3DPrinter#NeuralNetworks

Venture Village Wall 🦄

@venturevillagewall · Post #4169 · 16.02.2025 г., 22:00

Major AI Investments and Developments - France to invest €109 billion in AI, boosting Mistral's prospects. Read more - Elon Musk plans to pay $100 billion to buy OpenAI and prevent its commercialization. Details here - Research shows LLMs have better performance improvements compared to VLMs. GraphVLM Progress - OpenAI has new features in o1 and o3-mini, allows document uploads, increase to 50 queries for Plus subscribers. More info - Musk claims Grok 3 will outperform OpenAI’s offerings. Read about Grok - OpenAI to finalize its first custom chip this year to enhance trading with Nvidia. Reuters news #AI#OpenAI#ElonMusk#France#Investment#Chips#Mistral#LLM#VLM#DeepResearch#Grok#Crypto#Nvidia#TechNews#Finance#Market#Progress#Innovation#Data#Analysis

Venture Village Wall 🦄

@venturevillagewall · Post #3607 · 20.12.2024 г., 19:00

o3 & o3-mini Break Benchmark Records The performance of o3 and o3-mini showcases state-of-the-art (SOTA) results across various benchmarks. Key insights include: - Frontier Math scores increased from 2% to 25%. - SWE-Bench achieved 71.7%, a significant leap for a startup that recently raised $200 million with 13.86% earlier this year. - ELO on Codeforces reached 2727, held by only 150 individuals globally. - ARC-AGI model scored 87.5%, breaking a five-year deadlock. - Noteworthy progress on GPQA and AIME benchmarks. Access to o3-mini is currently available to security researchers, while general public access is set for late January. Full access to o3 will follow later. #AI#SOTA#Benchmarks#o3#o3-mini #FrontierMath#SWE-Bench #Codeforces#ELO#ARC-AGI #GPQA#AIME#Funding#Progress#Research#Technology#Innovation

EUROUZ 🇪🇺 🇺🇿 News

@eurouz_official · Post #220 · 08.12.2023 г., 06:07

[UZ] #EUROUZ jamoasi sizlarni #O'zbekiston Respulikasi #Konstitutsiyasi qabul qilinganligi #kuni bilan tabriklaydi! Tariximizdagi ushbu muhim sanani nishonlar ekanmiz, #Vatanimizga#farovonlik, #birdamlik, #taraqqiyot#bardoshlik tilab qolamiz! - [EN] #EUROUZ team extends congratulations on the occasion of #Constitution#Day of #Uzbekistan! Wishing #prosperity, #unity, and continued #progress to our #motherland as we celebrate this significant day in our history. - [RU] Команда #EUROUZ поздравляет соотечественников с Днём #Конституции Республики Узбекистан! Желаем процветания, единства и продолжения прогресса нашей #Родине в этот значимый день. Follow #EUROUZ on Telegram: @eurouz_official