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

Резултати

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

Пребарај: #civilrights

当前筛选 #civilrights清除筛选
Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40624 · 04.02.2026 г., 07:03

Rosa Parks was born on February 4, 1913. She is famous for her pivotal role in the Civil Rights Movement, especially for her courageous act of refusing to give up her seat on a bus in Montgomery, Alabama. Her birthday is celebrated as a day to honor her legacy and contributions to equality and justice. ✊🏽🌹 [Read more] @googlefactss #RosaParks#CivilRights#BlackHistoryMonth

American Оbserver

@american_observer · Post #4984 · 28.01.2026 г., 17:59

Minneapolis in Chaos: States Push Back on ICE After Minneapolis Shootings After two Americans were killed by federal agents in Minneapolis, Democratic lawmakers and libertarian allies are stepping up their fight against ICE’s tactics. The deaths of Alex Pretti and Renee Good have lit a fire under state legislatures, with new bills popping up from coast to coast. Colorado wants to let citizens sue federal agents for civil rights violations. Delaware and New York are targeting airlines that ferry ICE detainees without warrants. California is pushing for independent investigations into ICE shootings and banning the agency from staging operations on state property. “Democrats don’t care about the rule of law,” said a White House spokesperson. “They’re just protecting criminal illegal aliens.” Meanwhile, Republican-led states are doubling down on cooperation with ICE, pushing laws that force local sheriffs to partner up and check immigration status for everything from school enrollment to public benefits. But the momentum is shifting—more states are banning masked officers, restricting federal agents’ access to hospitals and schools, and cutting off public contracts with ICE contractors. “Power works this way: once you have it, you want more,” said Anya Bidwell of the Institute for Justice. “You gotta fight back if you want to protect your rights. This shouldn’t be about party lines.” So who’s actually looking out for civil rights here—the states, the feds, or just their own political interests? #ICE#Minneapolis#civilrights#Trump#Democrats#Republicans 📱American Оbserver - Stay up to date on all important events 🇺🇸

EKOLOG.UZ| ENG

@ekologuzenglish · Post #11615 · 15.02.2026 г., 14:59

🚨 Lawlessness or rule of law? A zoo volunteer’s home attacked in Yangiyul The conflict between animal rights defenders and the animal control service has escalated into open confrontation. According to volunteers, the situation has already gone beyond legal boundaries and is infringing on fundamental civil rights. Animal welfare activists Asiya Abuzyárova and Svetlana Velichko reported that about 30 dogs disappeared from the territory of a municipal improvement enterprise. After attempts to return the animals, pressure reportedly began: a complaint was filed with the police, a volunteer was attacked, her phone was broken, and activists were allegedly harassed. ❗️ The most serious incident was the forced entry into a private home. According to reports, municipal workers used a ladder to break a window and enter Asiya Abuzyárova’s house, forcibly removing the animals inside. When the homeowner resisted, her phone was destroyed and her hand was injured. ⚖️ According to the legislation of Uzbekistan: 🔹 The home is inviolable — entry without the residents’ consent is allowed only on legal grounds or by court order. 🔹 Private property is protected by the state — damage to property and unlawful seizure are prohibited. 🔹 Any actions by officials must have legal grounds and be properly documented. This may constitute unlawful entry into a residence, abuse of authority, and violation of citizens’ rights. 📢 Key questions arise: ✔️ On what legal basis were the animals seized? ✔️ Who authorized the entry into the home? ✔️ Why are reports of property damage and injuries being ignored? The law must apply equally to everyone — both citizens and officials. The situation requires a transparent investigation and a legal assessment of the actions of all parties. #Yangiyul#civilrights#animalprotection#ruleoflaw ☘️ Follow the latest environmental news on @ekologuz. Send your suggestions and feedback via @eklguz_bot

AI & Law

@ai_and_law · Post #222 · 23.01.2024 г., 08:04

Controversial Changes to EU's AI Act Allow Facial Recognition Without Judicial Approval Hello, everyone! Recent alterations to the AI Act, initially endorsed in December, are stirring controversy as they permit law enforcement to employ facial recognition on recorded video without judicial consent. German MEP Svenja Hahn decries these last-minute changes, asserting that they undermine civil rights and draw parallels with practices in authoritarian states. The revisions, concluded on December 22, diverge from the initial agreement, which mandated stricter conditions and judicial oversight for facial recognition use. Critics express concerns about post-facial recognition technology, emphasizing the need for clarity on privacy and oversight. The final text faces scrutiny on January 24, with potential amendments requiring further legislative attention. #FacialRecognition#AIAct#EuropeanUnion#CivilRights#PrivacyConcerns

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40141 · 20.11.2025 г., 15:05

🖖 In 1968, Dr. Martin Luther King Jr. personally convinced Nichelle Nichols not to resign from Star Trek. He told her she was portraying a vital role model – one of the first Black women in a major TV role not playing a servant. Dr. King personally told her to stay because Uhura represented a future of racial equality during the Civil Rights Movement. [Read more] @googlefactss#StarTrek#CivilRights#NichelleNichols#MLK#RepresentationMatters