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

Резултати

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

Пребарај: #ethiopianstudents

当前筛选 #ethiopianstudents清除筛选

🎓ETHIOPIAN STUDENTS IN RUSSIA: A CROSS-CONTINENTAL EDUCATIONAL JOURNEY ኢትዮጵያውያን ተማሪዎች በሩሲያ፡ የትምህርት ጉዞ 💡Why thousands choose Russian universities: Quality education in medicine, engineering, and economics that builds Ethiopia's future workforce. 🏛️TOP UNIVERSITIES | ዋና ዩኒቨርሲቲዎች: • Moscow State University (МГУ) - Medicine: 350,000-450,000 RUB/year • RUDN University - International programs: 280,000-380,000 RUB • Saint Petersburg State - Engineering: 320,000-420,000 RUB • Kazan Federal University - Economics: 250,000-350,000 RUB ❄️WINTER SURVIVAL GUIDE | የክረምት መጸብ: 🧥 "Первые три месяца я носил 5 курток одновременно!" - Ahmed, 2nd year 🌡️ From +40°C Ethiopia → -35°C Russia shock 🏠 "Общага спасла мне жизнь" - centralized heating discovery 🍲CULINARY ADVENTURES | የምግብ ጉዞ: 😋 "Что это за красный суп? Похож на Ethiopian stew!" - First borscht experience 🥞 Injera + Russian blini = unexpected combination success ☕ "Где настоящий Ethiopian coffee?!" - desperate search stories 💰FINANCIAL REALITY | የገንዘብ እውነታ: • Monthly living costs: 15,000-25,000 RUB (~4,000-7,000 ETB) • "Стипендия 2,000 рублей хватает на хлеб и чай" - budget student life • Part-time work opportunities in translation/tutoring 🎯PRO TIPS | ጠቃሚ ምክሮች: 📚 Russian language prep is CRUCIAL - start 6 months early 🏥 Medical insurance mandatory: ~12,000 RUB/year 📱 Download "Тройка" app for Moscow transport 🏠 "Ищите общагу рядом с метро" - location matters! ✨SUCCESS STORIES: "После 6 лет в России, теперь работаю врачом в Addis Ababa. Спасибо, Россия!" - Dr. Meron, graduate Expert-reviewed content | Verified by Ethiopian student community in Russia #EthiopianStudents#RussianEducation#StudyAbroad#ኢትዮጵያ#EducationJourney🇪🇹🇷🇺

🎓 ETHIOPIAN EDUCATION: Universities, Careers & Global Dreams ትምህርቶች በኢትዮጵያ 💡 Discover Ethiopia's education landscape: from ancient learning centers to modern universities, where young Ethiopians dream of studying abroad. 🏛️ TOP UNIVERSITIES IN ETHIOPIA | ታዋቂ ዩኒቨርሲቲዎች በኢትዮጵያ • Addis Ababa University (1950) - The flagship, medicine & engineering excellence • Jimma University - Medical powerhouse, largest health sciences faculty • Mekelle University - Engineering & technology focus, northern Ethiopia • Bahir Dar University - Agriculture & water resources specialization • Hawassa University - Business & agricultural sciences hub near beautiful Lake Hawassa 📍 HAWASSA UNIVERSITY SPOTLIGHT | ሀዋሳ ዩኒቨርሲቲ • Located in stunning Hawassa city with lakeside campus views • Strong business school - produces entrepreneurs for Ethiopia's growing economy • Agricultural innovation hub with international research partnerships • Why business matters: Ethiopia needs skilled managers and finance experts for economic transformation from agriculture to industrialization 🔥 MOST DEMANDED PROFESSIONS | ኢትዮጵያ ውስጥ የሚፈለጉ ሙያዎች • Medicine & Health Sciences - doctor shortage in rural areas (critical need!) • Engineering (Civil, Electrical, Software) - infrastructure boom demands • Agriculture & Food Science - 80% population depends on farming • IT & Computer Science - digital transformation wave • Business & Economics - growing private sector opportunities 🔬 WHAT IS STEM? | ሳይንስ፣ ቴክኖሎጂ፣ ኢንጂነሪንግ እና ሒሳብ • Science, Technology, Engineering, Mathematics - the future job engines • Government priority: 70% STEM vs 30% humanities in universities • Critical for Ethiopia's Vision 2030 development goals • Creates jobs in manufacturing, tech, healthcare, and infrastructure sectors 🌍 ETHIOPIANS ABROAD | የውጭ ሀገር የትምህርት እድል • Top destinations: USA, Germany, UK, Russia, China, India • Popular fields: Medicine (Russia/Ukraine), Engineering (Germany), IT (USA) • Scholarship programs: Fulbright, DAAD, Chinese Government, Indian ICCR • Brain drain vs. knowledge transfer - complex challenge 💰 EDUCATION COSTS & ACCESS | የ ትምህርት ወጪና ተደራሽነት • Public universities: ~5,000-8,000 ETB/year (affordable!) • Private institutions: 70,000-150,000 ETB/year • English medium instruction from Grade 9+ • Rural-urban education gap - major inequality issue 🚀 FUTURE TRENDS | የወደፊት አዝማሚያዎች • STEM focus - government priority for development • Online learning expansion post-COVID • Technical & Vocational Education (TVET) growth • International partnerships increasing 💰 PRO TIPS: Ethiopian Students Union associations exist in major global cities. Many Ethiopian graduates abroad send remittances home - $5+ billion annually. The government offers incentives for diaspora professionals to return and contribute to development. Entrepreneurship education is crucial for addressing youth unemployment. ✨ Expert-reviewed content | Verified by local Ethiopian education specialist #Ethiopia#ኢትዮጵያ#EthiopianEducation#StudyAbroad#HigherEducation#EthiopianStudents