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 слични објави

Пребарај: #chavismo

当前筛选 #chavismo清除筛选
Venezuelanalysis

@venanalysis · Post #1703 · 31.07.2024 г., 03:18

The Venezuelanalysis team held a livestream on Tuesday evening to provide an on-the-ground update of the situation in Venezuela following Sunday's elections. Watch the video: https://venezuelanalysis.com/video/venezuelas-post-election-scene-on-the-ground-reports/ #Venezuela#Chavismo#Elections2024

Venezuelanalysis

@venanalysis · Post #2063 · 13.08.2025 г., 16:38

📰 NEWS | Venezuelans Reject US Military Threats, ‘Narcoterrorism’ Allegations in Anti-Imperialist March Thousands joined the 'Great Anti-Imperialist March' in Caracas and other cities to reject US threats and the $50M bounty on President Maduro. The Trump administration accuses Maduro of ties to criminal groups, but has provided no court-tested evidence. Mexico’s President Claudia Sheinbaum said her government has 'no proof' of such links, while Colombia’s President Gustavo Petro condemned possible US military action in Latin America. 🔗 Read the full report here: https://shorturl.at/IlELJ #AntiImperialism#Chavismo#NicolasMaduro

Venezuelanalysis

@venanalysis · Post #2315 · 25.03.2026 г., 00:06

🖊OPINION | Venezuela: Between Imperial Intervention and Class Suicide Joan López and Alejandro Pedregal analyze Venezuela's post-January 3 setbacks and the broader implications for the anti-imperialist struggle. On January 3, 2026, a US military operation in Caracas resulted in the abduction of Nicolás Maduro and more than 90 deaths. In the weeks that followed, Venezuelan authorities advanced a reform of the hydrocarbon law allowing foreign companies to directly market oil production and ending the state monopoly on exports. The reform “eliminates any remaining obstacles to private operational control of that sector.” This opinion piece links these developments to shifts in economic policy and foreign relations following the change in leadership. Full piece here 👉🏽https://shorturl.at/CniyW #2026OilReform#Chavismo#Sanctions#USVenezuelaRelations

Venezuelanalysis

@venanalysis · Post #2371 · 18.05.2026 г., 20:58

🖊OPINION | The Post-January 3 Minefield in Venezuela What comes after January 3 in Venezuela? VA columnist Clodovaldo Hernández examines the political tensions shaping Venezuela after the US military attack, the kidnapping of President Nicolás Maduro and First Lady Cilia Flores, and the concessions and debates that have followed inside Chavismo and the opposition. “The controversy surrounding this issue lies dormant beneath the surface, like a geological fault line that became active following the bombing.” The piece looks at internal disagreements over reforms, sanctions, reconciliation efforts, and the evolving role of opposition sectors in the current political landscape. Read more here 👉https://shorturl.at/eOGkp #Chavismo#USVenezuelaRelations#Opposition#UnusualandExtraordinary

Venezuelanalysis

@venanalysis · Post #2040 · 26.07.2025 г., 15:29

📷 NEWS | Chavismo and Opposition Urge Voters to Participate in Final Campaign Push Ahead of Municipal Elections On Sunday, Venezuelans will elect 335 mayors and 2,471 municipal councillors. The vote marks the culmination of Venezuela’s electoral cycle, following last year’s presidential election and the recent legislative and regional races, both of which yielded favourable outcomes for the ruling United Socialist Party (PSUV) and allied organizations. Chavismo and opposition candidates wrapped up the 14-day campaign on Thursday with large rallies nationwide. Currently, two-thirds of the country's 335 municipalities are under Socialist control, while opposition factions hold over 100 mayoralties. Read our report (+photos): https://venezuelanalysis.com/images/chavismo-and-opposition-urge-voters-to-participate-in-final-campaign-push-ahead-of-municipal-elections/ #MunicipalElections#Chavismo#Opposition#Venezuela

Venezuelanalysis

@venanalysis · Post #2328 · 07.04.2026 г., 17:59

🗒️🗣️ INTERVIEW | Reinaldo Iturriza: ‘The Priority Is to Organize the Counter-Offensive’ Reinaldo Iturriza analyzes the present Venezuelan political context, the US attacks, and the strategic setbacks for the Bolivarian Process. He describes the January 3 events as “an invasion, in every sense of the word,” linking US actions to control over strategic resources such as oil, and stresses that “the priority must be on organizing the counter-offensive,” arguing that this requires rebuilding political organization and uniting forces to recover national sovereignty. Read the full interview here 👉🏾https://venezuelanalysis.com/interviews/reinaldo-iturriza-the-priority-is-to-organize-the-counter-offensive/ #Chavismo#USmilitaryattack#USVenezuelaRelations#DiarioRed

Marx21.it

@marx21news · Post #9546 · 12.01.2026 г., 15:59

Caracas sotto attacco: Delcy Rodríguez al centro della resistenza L’aggressione militare degli Stati Uniti e il sequestro del Presidente Nicolás Maduro non sono episodi isolati: fanno parte di una strategia globale di pressione contro la Rivoluzione Bolivariana. In questo momento cruciale, la Vicepresidente Delcy Rodríguez garantisce la continuità dello Stato, difende la legittimità costituzionale e contrasta la propaganda che cerca di dividere il PSUV. Come ha affermato: «Qui c’è un solo Presidente, e si chiama Nicolás Maduro Moros». Una frase che non è solo politica: è un argine contro il caos, la disinformazione e le pressioni esterne. Il chavismo resta un blocco politico solido, con istituzioni funzionanti, popolo organizzato e forze armate unite. La strategia di destabilizzazione esterna non passerà. #Venezuela#Chavismo#DelcyRodríguez#Sovranità#Maduro#Unità https://www.marx21.it/internazionale/caracas-sotto-attacco-psuv-sotto-pressione-delcy-rodriguez-nel-mirino-della-guerra-ibrida-contro-il-venezuela/

Venezuelanalysis

@venanalysis · Post #1512 · 27.03.2024 г., 23:26

Sociologist Reinaldo Iturriza delves into the phenomenon of “disaffiliation” in present-day Venezuela. "Political disaffiliation is what happens when a sector of the forces that identified with a certain project no longer recognizes itself in the present course of affairs or does not agree with the reorientation given by those exercising leadership roles. The disaffiliated individual is not willing to adopt what they interpret as a different course from the one that drove their identification with the project, and therefore can no longer see themselves in those who represent, so to speak, the political identity. Does the above imply a renunciation to the project, and even to its political identity? Absolutely not when it comes to the project, and not necessarily when it comes to political identity." Learn more here: https://shorturl.at/gELOU #politics#Politicaldisaffiliation#Venezuela#Chavismo#elections