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

Резултати

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

Пребарај: #course

当前筛选 #course清除筛选
America 🇺🇸 News & Politics

@America · Post #10012 · 24.10.2025 г., 02:34

😄Course ➖➖➖➖➖➖ A course often has a beginning and an end. If you set or follow a course it’s about where you’re going. 🔜Let’s set a course for home. 🔜We’re on course to get there on time 🔘If you’re studying something – the journey that you’re on is a course. 🔜I’ve just started my English course. 🔜My course ends next year. 🔘If you’re in a car race or a horse race, or playing golf – then you’re going round a course. 🔜This is a really difficult course – there are lots of obstacles. 🔜She got to the end of the course really quickly. 🔘If you’ve having a meal, you might eat different courses between the beginning and the end. 🔜My favourite course is always dessert. 🔘Another way that we use course is in the expression of course – which means either obviously or yes. 🔜Of course, I’ll need your help – can you do it? 🔜Of course! #Course👨‍🏫@America ➖➖➖➖➖➖➖➖➖➖➖➖ 🆕 Crypto News @Money 😁 Crypto Game @Egame 🇺🇸 US News @America 🇯🇵 Japan News @Japan 🇦🇪 UAE News @Dubai ▶️ Popular Movies @Videos 😜 Best Funny Video @Funnys

Hashtags

幽游地

@uudme · Post #3869 · 17.05.2020 г., 12:48

资源:英国原版collins big cat 1至11级 标签:#Course 幼儿教育资源 GD链接:https://drive.google.com/drive/folders/1uyiYG5vuvUBSbjvEt0nSH65Tv3Uvkbx8?usp=sharing @gduudme 若显示内容为空请耐心等待转码完成。资源收集自网络,如需删除请联系频道主

Hashtags

Клуб CDO

@cdo_club · Post #1989 · 24.07.2024 г., 20:52

И как бы прям в продолжении семинара сегодня анонс от команды Flower In partnership with Andrew Ng and his wonderful team at DeepLearning.AI we have launch two courses on federated learning using Flower! The two courses will cover both FL fundamentals, as well as how to federate LLMs and use them to safely include private, sensitive and regulated data. https://www.deeplearning.ai/short-courses/intro-to-federated-learning/?utm_campaign=flower-launch&utm_content=301436194&utm_medium=social&utm_source=twitter&hss_channel=tw-992153930095251456 To support these courses we have made a new slack channel: #course-deeplearning-ai in which we will answer questions, discuss the content and provide additional materials. We will also host an AMA next Monday from this channel that will be also broadcast on our YouTube channel: 29 July 16:00 UTC (09:00 SF, 12:00 NY, 17:00 LON, 18:00 CET, 21:30 IST, 00:00 北京)

Hashtags

Repositorio data science

@repo_science · Post #4210 · 13.09.2024 г., 01:44

#english#course 🤩 CURSO INGLES VAUGHAN 4.0 3 Niveles ✅Basico ✅Intermedio ✅Avanzado 195 Videos Por Nivel +Libros + Audios ----- Main channel: @repo_science Coupons: @freecoupons_reposcience -----

🌀Malayziyaning MRANTI va MATRADE tashkilotlari bilan innovatsiyalar sohasida hamkorlik Joriy yilning 5-iyuli Biznes va tadbirkorlik oliy maktabi delegatsiyasining Malayziyaga tashrifi doirasida Malayziya texnologiya va innovatsiyalar tadqiqot akseleratori (MRANTI) vakillari bilan uchrashuvi bo‘lib o‘tdi. 🇺🇿O‘zb 🤔Cooperation in the field of innovation with Malaysia's MRANTI and MATRADE organizations On July 5, 2024, within the framework of the working visit of the Graduate School of Business’s to Malaysia, a meeting was held with representatives from the Malaysian Research Accelerator for Technology and Innovation (MRANTI). 🇬🇧Eng ✍️Сотрудничество в сфере инноваций с малазийскими организациями MRANTI и MATRADE 5 июля т.г. в рамках пребывания делегации Высшей школы бизнеса и предпринимательства Узбекистана в Малайзии состоялась встреча с представителями Малазийского исследовательского акселератора технологий и инноваций (MRANTI). 🇷🇺Ru #GraduateSchool#Course#Training 🌐Web-site | ✅Telegram | ✅Facebook |🌐Instagram

Voir de ses propres yeux

@voir_yeux · Post #11733 · 14.02.2026 г., 17:08

🇷🇺Environ 6.000 personnes ont participé à une compétition de ski de masse à Khimki, près de Moscou. Les meilleurs ont été désignés dans quatre catégories principales sur une distance de 10 km. Des prix ont également été remis aux vainqueurs de la course costumée d’un kilomètre. #russie#ski#course

123•••56
ПретходнаСтраница 1 од 6Следна