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

Резултати

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

Пребарај: #southsudan

当前筛选 #southsudan清除筛选
RTDocumentary

@rtdocumentary · Post #147 · 02.08.2021 г., 10:00

#photo#SouthSudan The world’s newest country, South Sudan, marked a decade of independence this month, but it’s still one of the world’s poorest nations, scarred by war and hunger. South Sudan gained independence in 2011, but an intertribal conflict broke out two years later that escalated into a full-blown civil war which has crippled the country’s economy and agriculture. This Red Cross station in Kobok was the only place where people in South Sudan’s Upper Nile region could get medical help, make phone calls, or simply get something to eat. The Red Cross staff treated all patients equally, regardless of whether they were soldiers or civilians. Unfortunately, the hospital was destroyed by government forces three weeks after our crew filmed it. Follow: https://t.me/rtdocumentary

POPULAR FRONT

@popularxfront · Post #4955 · 11.02.2026 г., 07:17

🇨🇳#China - 🇸🇸#SouthSudan: Chinese troops from the 12th Chinese Peacekeeping Infantry Battalion under UNMISS (UN mission in South Sudan) conducted live-fire training in South Sudan last week. UNMISS has been in the country since 2011 to protect civilians and support stability. The Chinese contingent previously drew major attention after the July 2016 Juba violence, when internal UN findings said Chinese and Ethiopian peacekeepers did not leave their bases to assist civilians despite orders to intervene. An aid workers’ compound only a few hundred meters from a UN base received no help despite repeated distress calls and a survivor personally reaching the base and pleading for help. Multiple civilians, as well as a journalist, were killed during the clashes at that time.

Russian MFA 🇷🇺

@MFARUSSIA · Post #29419 · 21.04.2026 г., 22:40

🇷🇺🇸🇸 The Ambassador of Russia to South Sudan, A.Kosmodemiyanskiy, met with the Minister of Presidential Affairs of South Sudan, Africano Mande Gedima. 🔸 During the friendly and constructive discussion, current issues of bilateral relations were addressed. 🔸A.Kosmodemiyanskiy handed over to the Minister a copy of the personal invitationfrom the President of the Russian Federation, Vladimir Putin, to the President of South Sudan, Salva Kiir Mayardit, to attend the Third Russia-Africa Summit, which will take place in Moscow in October this year. 🔸 Following the meeting, the parties agreed to expand political, economic, and cultural cooperation between the two countries, as well as to arrange training in Russia for staffof the National Elections Commission of South Sudan in preparation for the upcoming presidential elections in December this year. #Africa#Russia#SouthSudan

ጠቅላይ ሚኒስትር ዐቢይ አሕመድ (ዶ/ር) ለይፋዊ የሥራ ጉብኝት አዲስ አበባ የገቡትን የደቡብ ሱዳን ፕሬዚዳንት ሳልቫ ኪር ማያርዲትን ተቀበሉ *********************** ጠቅላይ ሚኒስትር ዐቢይ አሕመድ (ዶ/ር) የሁለት ቀናት ይፋዊ የሥራ ጉብኝት ለማድረግ አዲስ አበባ ለገቡት የደቡብ ሱዳን ሪፐብሊክ ፕሬዚዳንት ሳልቫ ኪር ማያርዲት በቤተ-መንግሥት አቀባበል አድርገዋል። ይህ ጉብኝት በሁለቱ ሀገራት መካከል ያለውን ጠንካራ እና ዘላቂ ወዳጅነት በተግባር የሚያሳይ መሆኑን ጠቅላይ ሚኒስትሩ በማኅበራዊ ትሥሥር ገጽ ባስተላለፉት መልዕክት ገልጸዋል። በቆይታቸውም በሁለቱ ሀገራት መካከል ያለውን የሁለትዮሽ ትብብር ይበልጥ ለማጠናከር እና በጋራ ፍላጎቶች ላይ ለመምከር ፍሬያማ ውይይት እንደሚያደርጉ ያላቸውን እምነት ገልጸዋል። የፕሬዚዳንት ሳልቫ ኪር ጉብኝት በምሥራቅ አፍሪካ ቀጣናዊ ትሥሥር እና ሰላምን ለማረጋገጥ ሀገራችን ለምትከተለው የዲፕሎማሲ ግንኙነት ትልቅ ፋይዳ እንዳለው ተመልክቷል። #EBC#Ethiopia#SouthSudan#diplomacy#hornofafrica

ፕሬዚዳንት ሳልቫ ኬር ማያርድት ጉብኝታቸውን አጠናቀው ተመለሱ ************** በኢትዮጵያ ይፋዊ የሥራ ጉብኝት ሲያደርጉ የቆዩት የደቡብ ሱዳን ፕሬዚዳንት ሳልቫ ኬር ማያርድት ጉብኝታቸውን አጠናቀው ዛሬ ተመልሰዋል። ፕሬዝዳንቱ ጉብኝታቸውን አጠናቀው ሲመለሱ ምክትል ጠቅላይ ሚኒስትር ተመስገን ጥሩነህ በቦሌ ዓለም አቀፍ አውሮፕላን ማረፊያ በመገኘት ሽኝት አድርገውላቸዋል። ፕሬዝዳንት ሳልቫ ኬር በቆይታቸው ከከፍተኛ የኢትዮጵያ የሥራ ኃላፊዎች ጋር በሁለትዮሽ እና ቀጠናዊ ጉዳዮች ዙሪያ መምከራቸው ይታወሳል። በአሸናፊ እንዳለ #EthiopianBroadcastingCorporation#ሳልቫ_ኬር#ተመስገን_ጥሩነህ#Ethiopia#SouthSudan#SalvaKiir#Diplomacy

AI match predictions

@ai_match_prediction · Post #11211 · 29.03.2026 г., 05:05

Africa Cup of Nations - Qualification🌍 2026-03-29 13:00 UTC South Sudan vs. Djibouti Predicted outcome: South Sudan❌ Predicted score: 4:0 Actual: Djibouti 0:1 #SouthSudan#Djibouti 2026-03-29 15:00 UTC Lesotho vs. Seychelles Predicted outcome: Draw❌ Predicted score: 0:0 Actual: Lesotho 2:1 #Lesotho#Seychelles #Football#AfricaCupofNations

AI match predictions

@ai_match_prediction · Post #11186 · 26.03.2026 г., 09:05

Africa Cup of Nations - Qualification🌍 2026-03-26 13:00 UTC Djibouti vs. South Sudan Predicted outcome: South Sudan✅ Predicted score: 1:3 Actual: South Sudan 0:4 #Djibouti#SouthSudan 2026-03-26 14:00 UTC Seychelles vs. Lesotho Predicted outcome: Lesotho❌ Predicted score: 0:2 Actual: Draw 0:0 #Seychelles#Lesotho #Football#AfricaCupofNations