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

Резултати

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

Пребарај: #evaluation

当前筛选 #evaluation清除筛选

🌍Innovatsion biznesda texnologik transfer mavzusida amaliy seminar 🎓 Respublikamizda tadbirkorlik subyektlari tomonidan innovatsion ishlanmalar, yangi texnologiyalar va nou-xaularni ishlab chiqarishga joriy etishni qo‘llab-quvvatlash maqsadida Biznes va tadbirkorlik oliy maktabi 2024-yil 5-6-noyabr kunlari “Innovatsion biznes va startaplarni rivojlantirishda texnologiyalar transferi” mavzusida ikki kunlik seminar tashkil etmoqda. ➡️ Seminardan maqsad innovatsion loyihalarni amalga oshirishda ilm-fan yutuqlari va innovatsion ishlanmalarga oid texnologik transferni keng qo‘llashning amaliy jihatlarini o‘rganishdan iborat. 💠 Tadbirda Koreyalikekspert va mahalliymutaxassislar tomonidan mavzuga oid taqdimot, ma’ruza hamda muhokamalar o‘tkaziladi. 🔹 Seminarda ishtirok etish uchun 2024-yil 4-noyabrga qadar ro‘yxatdan o‘tish lozim. 🔗Ro‘yxatdan o‘tish. 🔷 Ishtirokchilar soni cheklangan. 🔝 Sanasi: 5-6-noyabr 🔝 Vaqti: 09-30 – 13-00 📞 Telefon: +99871 239-03-27 🇬🇧Eng 🇷🇺Ru #GraduateSchool#Healthtech#Startup#Evaluation 🔝Web-site |🔝Facebook | 🔝Instagram | 🔝Youtube

🌟Startup Evaluation: HealthTech Series 🌟 📣Biznes va tadbirkorlik oliy maktabi Toshkent tibbiyot akademiyasi bilan hamkorlikda sog‘liqni saqlash va tibbiy texnologiyalar sohasida dastlabki inkubatsiya bosqichidagi startap loyihalarni qo‘llab-quvvatlash va rivojlantirish bo‘yicha “Startup Evaluation: HealthTech Series” loyihasini amalga oshirmoqda. 💠Tadbirdan maqsad - sog‘liqni saqlash sohasida yosh startap tashabbuskorlari hamda biznes va ta’lim sohasidagi yetakchi ekspertlar o'rtasida samarali muloqotni tashkil etishdan iboratdir. Tadbir yosh startap egalari uchun startap loyihasini rivojlantirishda qulay imkoniyat yaratadi. ➡️Tadbirda startaplarni quyidagilar kutmoqda: 🔘 o‘z biznes loyihalarini taqdimot qilish va ekspertlar bilan startaplarni amalgaoshirish bo‘yicha fikr almashish imkoniyati; 🔘 bizines sohasidagi yetakchi professor va ekspertlardan maslahatlar olish; 🟣 startap loyihalarnitakomillashtirish bo‘yicha navbatdagi qadamlarni muhokama qilish; 🟡 startaplarni kelgusida rivojlantirish bo‘yicha Oliy maktabining ko‘magiga tayanish. 🔍Ma’lumot uchun: “Startup Evaluation" loyihasi - bu Biznes va tadbirkorlik oliy maktabining startaplarni qo‘llab-quvvatlash platformasi bo‘lib, yosh startap tashabbuskorlarining startap loyihalarini qisqa muddatda amalga oshirish bo‘yicha o’zaro hamkorlikni nazarda tutadi. 🗓 Sana: 2024-yil 8-oktabr 🕖 Vaqt: 09:00-13:00. 📱 Telefon: +998712390327 📍 Joylashuv: Biznes va tadbirkorlik oliy maktabi (5-qavat) 🇬🇧Eng 🇷🇺Ru #GraduateSchool#Healthtech#Startup#Evaluation 🔝Web-site |🔝Facebook | 🔝Instagram | 🔝Youtube

GitHub Trends

@githubtrending · Post #14797 · 06.06.2025 г., 12:00

#python#agents#document_search#evaluation#guardrails#llms#optimization#prompts#rag#vector_stores Ragbits is a tool that helps build and deploy GenAI applications quickly. It offers features like swapping between many language models, ensuring safe interactions with these models, and connecting to various data storage systems. Ragbits also includes tools for managing data and testing prompts, making it easier to develop reliable AI applications. This helps users create more accurate and efficient AI systems by integrating the latest data and reducing errors. Overall, Ragbits makes it faster and more efficient to develop and deploy AI applications. https://github.com/deepsense-ai/ragbits

GitHub Trends

@githubtrending · Post #14661 · 02.05.2025 г., 11:30

#typescript#ai#analytics#datasets#dspy#evaluation#gpt#llm#llmops#low_code#observability#openai#prompt_engineering LangWatch helps you monitor, test, and improve AI applications by tracking performance, comparing different setups, and optimizing prompts automatically. It works with any AI tool or framework, keeps your data secure, and lets you collaborate with experts to fix issues quickly, making your AI more reliable and efficient. https://github.com/langwatch/langwatch

GitHub Trends

@githubtrending · Post #15253 · 30.10.2025 г., 12:30

#go#agent#agentic#ai#chatbot#chatbots#embeddings#evaluation#generative_ai#golang#knowledge_base#llm#multi_tenant#multimodel#ollama#openai#question_answering#rag#reranking#semantic_search#vector_search WeKnora is a powerful tool that helps you understand and find answers in complex documents like PDFs and Word files. It uses advanced AI to read documents, understand what they mean, and answer your questions in a simple way. This tool is useful for businesses and researchers because it can quickly find information from many documents, making it easier to manage knowledge and make decisions. It also supports multiple languages and can be used privately, ensuring your data stays safe. https://github.com/Tencent/WeKnora

GitHub Trends

@githubtrending · Post #14768 · 31.05.2025 г., 12:00

#typescript#ci#ci_cd#cicd#evaluation#evaluation_framework#llm#llm_eval#llm_evaluation#llm_evaluation_framework#llmops#pentesting#prompt_engineering#prompt_testing#prompts#rag#red_teaming#testing#vulnerability_scanners Promptfoo is a tool that helps developers test and improve AI applications using Large Language Models (LLMs). It allows you to **test prompts and models** automatically, **secure your apps** by finding vulnerabilities, and **compare different models** side-by-side. You can use it on your computer or integrate it into your development workflow. This tool helps you make sure your AI apps work well and are secure before you release them. It saves time and ensures quality by using data instead of guessing. https://github.com/promptfoo/promptfoo