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

Резултати

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

Пребарај: #saopaulo

当前筛选 #saopaulo清除筛选
Reuters: World

@reutersworldchannel · Post #149190 · 10.10.2021 г., 17:59

Boxing offers kids a fighting chance in Sao Paulo’s favelas A new boxing program in Sao Paulo’s gritty south side aims to ensure kids stay in school, keep them active and teach them discipline. #Boxing#SaoPaulo#Brazil#favela#News#Reuters Subscribe: http://smarturl.it/reuterssubscribe Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled. Get the latest news on: http://reuters.com/ Follow Reuters on Facebook: https://www.facebook.com/Reuters Follow Reuters on Twitter: https://twitter.com/Reuters Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en ➖@reutersworldchannel➖

AI match predictions

@ai_match_prediction · Post #11132 · 21.03.2026 г., 13:05

Brazil Serie A🇧🇷 2026-03-21 19:00 UTC RB Bragantino vs. Botafogo Predicted outcome: Draw❌ Predicted score: 1:1 Actual: Botafogo 1:2 #RBBragantino#Botafogo 2026-03-21 21:30 UTC Fluminense vs. Atletico-MG Predicted outcome: Fluminense✅ Predicted score: 2:0 Actual: Fluminense 1:0 #Fluminense#AtleticoMG 2026-03-22 00:00 UTC Sao Paulo vs. Palmeiras Predicted outcome: Draw❌ Predicted score: 1:1 Actual: Palmeiras 0:1 #SaoPaulo#Palmeiras #Football#BrazilSerieA

AI match predictions

@ai_match_prediction · Post #11301 · 04.04.2026 г., 17:05

Brazil Serie A🇧🇷 2026-04-04 21:30 UTC Sao Paulo vs. Cruzeiro Predicted outcome: Sao Paulo✅ Predicted score: 2:1 Actual: Sao Paulo 4:1 #SaoPaulo#Cruzeiro 2026-04-04 23:30 UTC Coritiba vs. Fluminense Predicted outcome: Draw✅ Predicted score: 1:1 Actual: Draw 1:1 #Coritiba#Fluminense 2026-04-05 00:00 UTC Vasco DA Gama vs. Botafogo Predicted outcome: Vasco DA Gama❌ Predicted score: 2:1 Actual: Botafogo 1:2 #VascoDAGama#Botafogo #Football#BrazilSerieA

AI match predictions

@ai_match_prediction · Post #11442 · 11.04.2026 г., 13:05

Brazil Serie A🇧🇷 2026-04-11 19:30 UTC Vitoria vs. Sao Paulo Predicted outcome: Draw❌ Predicted score: 1:1 Actual: Vitoria 2:0 #Vitoria#SaoPaulo 2026-04-11 21:30 UTC Mirassol vs. Bahia Predicted outcome: Mirassol❌ Predicted score: 2:1 Actual: Bahia 1:2 #Mirassol#Bahia 2026-04-11 23:00 UTC Santos vs. Atletico-MG Predicted outcome: Draw❌ Predicted score: 1:1 Actual: Santos 1:0 #Santos#AtleticoMG 2026-04-11 23:30 UTC Internacional vs. Gremio Predicted outcome: Draw✅ Predicted score: 1:1 Actual: Draw 0:0 #Internacional#Gremio #Football#BrazilSerieA

AI match predictions

@ai_match_prediction · Post #11581 · 18.04.2026 г., 17:05

Brazil Serie A🇧🇷 2026-04-18 21:30 UTC Chapecoense-sc vs. Botafogo Predicted outcome: Botafogo✅ Predicted score: 1:2 Actual: Botafogo 1:4 #Chapecoensesc#Botafogo 2026-04-18 21:30 UTC Vasco DA Gama vs. Sao Paulo Predicted outcome: Vasco DA Gama✅ Predicted score: 2:1 Actual: Vasco DA Gama 2:1 #VascoDAGama#SaoPaulo 2026-04-18 23:00 UTC Vitoria vs. Corinthians Predicted outcome: Draw✅ Predicted score: 1:1 Actual: Draw 0:0 #Vitoria#Corinthians 2026-04-18 23:30 UTC Cruzeiro vs. Gremio Predicted outcome: Cruzeiro✅ Predicted score: 2:1 Actual: Cruzeiro 2:0 #Cruzeiro#Gremio #Football#BrazilSerieA

AI match predictions

@ai_match_prediction · Post #11951 · 07.05.2026 г., 17:05

CONMEBOL Sudamericana🌎 2026-05-07 22:00 UTC O'Higgins vs. Sao Paulo Predicted outcome: Draw✅ Predicted score: 1:1 Actual: Draw 0:0 #OHiggins#SaoPaulo 2026-05-07 22:00 UTC Boston River vs. Millonarios Predicted outcome: Millonarios✅ Predicted score: 0:1 Actual: Millonarios 2:4 #BostonRiver#Millonarios 2026-05-08 00:30 UTC Carabobo FC vs. River Plate Predicted outcome: Draw❌ Predicted score: 0:0 Actual: River Plate 1:2 #CaraboboFC#RiverPlate 2026-05-08 00:30 UTC Blooming vs. RB Bragantino Predicted outcome: Blooming❌ Predicted score: 3:2 Actual: RB Bragantino 0:6 #Blooming#RBBragantino #Football#CopaSudamericana

AI match predictions

@ai_match_prediction · Post #11745 · 25.04.2026 г., 17:05

Brazil Serie A🇧🇷 2026-04-25 21:30 UTC Bahia vs. Santos Predicted outcome: Bahia❌ Predicted score: 2:1 Actual: Draw 2:2 #Bahia#Santos 2026-04-25 21:30 UTC Botafogo vs. Internacional Predicted outcome: Botafogo❌ Predicted score: 2:1 Actual: Draw 2:2 #Botafogo#Internacional 2026-04-25 21:30 UTC Remo vs. Cruzeiro Predicted outcome: Cruzeiro✅ Predicted score: 0:1 Actual: Cruzeiro 0:1 #remo#Cruzeiro 2026-04-26 00:00 UTC Sao Paulo vs. Mirassol Predicted outcome: Sao Paulo✅ Predicted score: 2:1 Actual: Sao Paulo 1:0 #SaoPaulo#Mirassol #Football#BrazilSerieA

AI match predictions

@ai_match_prediction · Post #11510 · 14.04.2026 г., 17:05

CONMEBOL Sudamericana🌎 2026-04-14 22:00 UTC Sao Paulo vs. O'Higgins Predicted outcome: Sao Paulo✅ Predicted score: 1:0 Actual: Sao Paulo 2:0 #SaoPaulo#OHiggins 2026-04-14 22:00 UTC Gremio vs. Deportivo Riestra Predicted outcome: Draw❌ Predicted score: 1:1 Actual: Gremio 1:0 #Gremio#DeportivoRiestra 2026-04-15 00:00 UTC Vasco DA Gama vs. A. Italiano Predicted outcome: Draw❌ Predicted score: 1:1 Actual: A. Italiano 1:2 #VascoDAGama#AItaliano 2026-04-15 00:30 UTC Santos vs. Deportivo Recoleta Predicted outcome: Draw✅ Predicted score: 1:1 Actual: Draw 1:1 #Santos#DeportivoRecoleta 2026-04-15 00:30 UTC Palestino vs. Atletico Torque Predicted outcome: Draw❌ Predicted score: 1:1 Actual: Atletico Torque 0:2 #Palestino#AtleticoTorque #Football#CopaSudamericana

AI match predictions

@ai_match_prediction · Post #11898 · 03.05.2026 г., 13:05

Brazil Serie A🇧🇷 2026-05-03 19:00 UTC Sao Paulo vs. Bahia Predicted outcome: Sao Paulo❌ Predicted score: 2:1 Actual: Draw 2:2 #SaoPaulo#Bahia 2026-05-03 19:00 UTC Flamengo vs. Vasco DA Gama Predicted outcome: Flamengo❌ Predicted score: 3:1 Actual: Draw 2:2 #Flamengo#VascoDAGama 2026-05-03 21:30 UTC Internacional vs. Fluminense Predicted outcome: Fluminense❌ Predicted score: 1:2 Actual: Internacional 2:0 #Internacional#Fluminense 2026-05-03 21:30 UTC Chapecoense-sc vs. RB Bragantino Predicted outcome: RB Bragantino✅ Predicted score: 1:2 Actual: RB Bragantino 1:2 #Chapecoensesc#RBBragantino 2026-05-03 23:30 UTC Mirassol vs. Corinthians Predicted outcome: Mirassol✅ Predicted score: 2:1 Actual: Mirassol 2:1 #Mirassol#Corinthians #Football#BrazilSerieA

AI match predictions

@ai_match_prediction · Post #11366 · 07.04.2026 г., 17:05

CONMEBOL Sudamericana🌎 2026-04-07 22:00 UTC Barracas Central vs. Vasco DA Gama Predicted outcome: Draw✅ Predicted score: 1:1 Actual: Draw 0:0 #BarracasCentral#VascoDAGama 2026-04-07 22:00 UTC Independiente Petrolero vs. Racing Club Predicted outcome: Racing Club✅ Predicted score: 1:3 Actual: Racing Club 1:3 #IndependientePetrolero#RacingClub 2026-04-08 00:00 UTC O'Higgins vs. Millonarios Predicted outcome: Millonarios❌ Predicted score: 1:3 Actual: O'Higgins 2:0 #OHiggins#Millonarios 2026-04-08 00:30 UTC Boston River vs. Sao Paulo Predicted outcome: Draw❌ Predicted score: 1:1 Actual: Sao Paulo 0:1 #BostonRiver#SaoPaulo 2026-04-08 02:00 UTC Alianza Atletico vs. Tigre Predicted outcome: Tigre❌ Predicted score: 1:2 Actual: Draw 1:1 #AlianzaAtletico#Tigre #Football#CopaSudamericana

AI match predictions

@ai_match_prediction · Post #12030 · 10.05.2026 г., 13:05

Brazil Serie A🇧🇷 2026-05-10 19:00 UTC Atletico-MG vs. Botafogo Predicted outcome: Atletico-MG❌ Predicted score: 3:2 Actual: Draw 1:1 #AtleticoMG#Botafogo 2026-05-10 21:30 UTC Santos vs. RB Bragantino Predicted outcome: Santos✅ Predicted score: 2:1 Actual: Santos 2:0 #Santos#RBBragantino 2026-05-10 21:30 UTC Corinthians vs. Sao Paulo Predicted outcome: Corinthians✅ Predicted score: 2:1 Actual: Corinthians 3:2 #Corinthians#SaoPaulo 2026-05-10 21:30 UTC Mirassol vs. Chapecoense-sc Predicted outcome: Mirassol❌ Predicted score: 3:0 Actual: Draw 1:1 #Mirassol#Chapecoensesc 2026-05-10 22:30 UTC Gremio vs. Flamengo Predicted outcome: Flamengo✅ Predicted score: 1:2 Actual: Flamengo 0:1 #Gremio#Flamengo 2026-05-10 23:30 UTC Vasco DA Gama vs. Atletico Paranaense Predicted outcome: Vasco DA Gama✅ Predicted score: 2:1 Actual: Vasco DA Gama 1:0 #VascoDAGama#AtleticoParanaense #Football#BrazilSerieA

AI match predictions

@ai_match_prediction · Post #11801 · 28.04.2026 г., 17:05

CONMEBOL Sudamericana🌎 2026-04-28 22:00 UTC Botafogo vs. Independiente Petrolero Predicted outcome: Botafogo✅ Predicted score: 2:0 Actual: Botafogo 3:0 #Botafogo#IndependientePetrolero 2026-04-28 22:00 UTC San Lorenzo vs. Santos Predicted outcome: Draw✅ Predicted score: 1:1 Actual: Draw 1:1 #SanLorenzo#Santos 2026-04-29 00:00 UTC Barracas Central vs. A. Italiano Predicted outcome: Draw✅ Predicted score: 1:1 Actual: Draw 1:1 #BarracasCentral#AItaliano 2026-04-29 00:30 UTC Millonarios vs. Sao Paulo Predicted outcome: Sao Paulo❌ Predicted score: 1:2 Actual: Draw 0:0 #Millonarios#SaoPaulo 2026-04-29 00:30 UTC Deportivo Recoleta vs. Deportivo Cuenca Predicted outcome: Draw✅ Predicted score: 1:1 Actual: Draw 0:0 #DeportivoRecoleta#DeportivoCuenca 2026-04-29 02:00 UTC O'Higgins vs. Boston River Predicted outcome: O'Higgins✅ Predicted score: 2:1 Actual: O'Higgins 2:0 #OHiggins#BostonRiver #Football#CopaSudamericana

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