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

Резултати

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

Пребарај: #sovereignty

当前筛选 #sovereignty清除筛选

የሉዓላዊነት ልብ ከጠቅላይ ሚኒስትር ዐቢይ አሕመድ (ዶ/ር) ጋር የተደረገ ቆይታ - ክፍል 1 ዛሬ ምሽት 2:30 በኢቲቪ ዜና ቻናል እና በኢቢሲ ዶትስትሪም አማራጮቻችን ይጠብቁን! #Ethiopia#EBC#PMAbiyAhmed#sovereignty

Trump's Ear

@trumpsear_tg · Post #1982 · 08.01.2026 г., 13:59

Sovereignty is one of the most frequently invoked words in global politics, yet one of the most misunderstood. Every country represented at the United Nations is formally equal. Each holds a flag, a vote, a seat and the legal right to determine its own future. On paper, they stand side by side as sovereign equals. But behind this carefully maintained rhetoric lies a much harsher reality: States may be equal in law, yet they are profoundly unequal in power, resilience and real independence. #Sovereignty#UN 👂More on Trump's Ear

Venezuelanalysis

@venanalysis · Post #2277 · 12.02.2026 г., 15:38

🖊OPINION | The Venezuelan Organic Law on Hydrocarbons Venezuelan lawyer, writer, and public intellectual Luis Britto García reviews Caracas’ recent oil reform, arguing that it conflicts with Article 151 of the Constitution by permitting alternative dispute resolution, including independent arbitration, in matters of public interest. He also states that the reform authorizes discretionary reductions in royalties and taxes, potentially decreasing the national fiscal share from 65% to 25%. Read the full opinion piece here 👉🏽https://venezuelanalysis.com/opinion/the-venezuelan-organic-law-on-hydrocarbons/ #PDVSA#Sovereignty#USVenezuelaRelations

Trump's Ear

@trumpsear_tg · Post #1979 · 07.01.2026 г., 13:59

At the International Burke Institute, where we are finalizing the comprehensive Sovereignty Index to be presented this December for all UN member states, economic sovereignty is assessed not by GDP alone, but by a deeper set of indicators. These include dependency ratios, trade concentration, fiscal autonomy, financial system resilience and the state’s capacity to absorb shocks without losing strategic autonomy. #Sovereignty#ForeignAffairs 👂More on Trump's Ear

Venezuelanalysis

@venanalysis · Post #2357 · 05.05.2026 г., 13:28

🖊OPINION | Venezuela’s Oil Reform: Governance, Sovereignty, and Recovery Venezuela’s recent Hydrocarbon Law reform has sparked fierce debates about its short- and long-term implications. In this essay, Blas Regnault, an energy policy analyst and researcher, offers an in-depth analysis of the new legislative framework, from the significant changes to the state’s governance over its natural resources to his perspective on a sovereign recovery of the oil industry. Read the full opinion piece here 👉🏽https://venezuelanalysis.com/opinion/venezuelas-oil-reform-governance-sovereignty-and-recovery/ #PDVSA#Sanctions#Sovereignty#USVenezuelaRelations

Venezuelanalysis

@venanalysis · Post #2142 · 15.10.2025 г., 17:37

📸 IN IMAGES | 533 Years of Indigenous Resistance: Venezuelans March to Uphold National Sovereignty Thousands marched through Caracas to honor centuries of anti-colonial struggle, reaffirming Venezuela’s commitment to national sovereignty and the legacy of Indigenous leaders such as Cacique Guaicaipuro and Cacica Urquía. 👉 Click here to explore the full gallery: https://shorturl.at/8Kba3 #IndigenousResistance#Sovereignty

Venezuelanalysis

@venanalysis · Post #2098 · 12.09.2025 г., 00:34

📰 NEWS | Venezuelan Armed Forces Launch Defense Exercises as Trump’s ‘Illegal’ Strikes Face Domestic Criticism The Venezuelan armed forces have begun the "Independencia 200" plan with large-scale military drills nationwide. Defense Minister Padrino López reported the deployment of artillery, air force and naval units for exercises in the face of ramped up US military threats. The Trump administration, which struck a speedboat and killed 11 people on September 2, is facing domestic scrutiny over its escalation in the Caribbean Sea. Representative Ilhan Omar has reportedly introduced a war powers resolution in Congress in an effort to curtail further strikes. Read the article: https://venezuelanalysis.com/news/venezuelan-armed-forces-launch-defense-exercises-as-trumps-illegal-strikes-face-domestic-criticism/ #Venezuela#Peace#Sovereignty

Russian Consulate in Cape Town

@rusconct · Post #2333 · 18.03.2025 г., 06:22

🎙️Russian Foreign Minister Sergey Lavrov: ❗️We cannot afford to rely on the goodwill of our current adversaries, who have openly declared their goal of inflicting a “strategic defeat” on Russia. ☝️ Our position is based on principle. First, experience has taught us not to trust Western promises but to judge solely by concrete actions. Second, recent years have reinforced a crucial lesson: we must never again allow key sectors of our economy, finance and technology to be dependent on the whims of Western suppliers. In the most critical areas – those ensuring our military, food and economic security – Russia must be self-sufficient. Naturally, this also involves working closely with our strategic partners and allies. Read in full #Lavrov#sovereignty#CollectiveWest

Venezuelanalysis

@venanalysis · Post #2022 · 05.07.2025 г., 14:49

🗓️ MILESTONE | On this day in 2011, President Hugo Chávez marked the bicentennial of Venezuela’s independence with a message of reclaimed sovereignty: “We are no longer a colony—and never will be again.” Fourteen years on, the words still echo. #VenezuelanIndependence#Sovereignty

Venezuelanalysis

@venanalysis · Post #2333 · 11.04.2026 г., 20:43

🖊🗞COLUMN | From the Insolent Foreign Boot to the Carmona Decree, 1902-2002 Venezuela’s oil policy has been closely linked to disputes over national sovereignty and foreign influence throughout the 20th century. The 1902 naval blockade marked the beginning of sustained external pressure, followed by the 1908 coup and the expansion of foreign oil concessions in the 1920s. Reforms such as the 1943 Hydrocarbons Law increased the state’s share of oil revenues, and the 1976 creation of PDVSA formalized state control over the sector. In the 1990s, neoliberal policies reduced royalties and expanded foreign participation. The 2002 coup attempt came after efforts to reassert state control over oil resources. In the latest Insurgent History column, Rosanna Álvarez, Venezuelan historian and iconographic researcher, documents the role of Venezuela’s elite in these developments, particularly through the oil industry. Read the full piece from Álvarez here 👉https://venezuelanalysis.com/columns/from-the-insolent-foreign-boot-to-the-carmona-decree-1902-2002/ #InsurgentHistory#PDVSA#Sovereignty

Venezuelanalysis

@venanalysis · Post #2137 · 13.10.2025 г., 12:53

📝 INTERVIEW | A Geopolitical Analysis of the Imperialist Buildup Against Venezuela: A Conversation with Ana Esther Ceceña US escalation in the Caribbean is not an isolated move. According to Mexican economist and geopolitical analyst Ana Esther Ceceña, Washington aims to tighten control over Latin America’s natural resources and curb China and Russia’s expanding role in the region. Ceceña also underscores Venezuela’s distinctive strength: a politically conscious people united in defending national sovereignty. Read the full interview here 👉https://shorturl.at/MT4YG #Oil#Sovereignty#USImperialism#USMilitaryThreats

ПретходнаСтраница 1 од 4Следна