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

Резултати

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

Пребарај: #codes

当前筛选 #codes清除筛选
APKPure_Official

@apkpurechannel · Post #3007 · 14.05.2026 г., 11:00

🆓REDEEM CODES🆓 🚀🚀AFK Arena Redeem 🎁#Codes ✅✨May 2026 Grab these handy redeem codes for instant AFK Arena boosts, and breeze your way to victory effortlessly! 📌13thlilith 📌4hwzcs2umh 🌟🎁AFK Arena Latest Codes in May 2026 Add @APKFreeDownloader_Bot to get any apk you want.

Hashtags

APKPure_Official

@apkpurechannel · Post #3001 · 10.05.2026 г., 11:00

🆓REDEEM CODES🆓 🦋🌺Infinity Nikki #Codes (May 2026) 🎀🕹️Download Infinity Nikki on Android Claim your Infinity Nikki codes for fantastic freebies! 📌Here's an active code for you: ✅NIKKISHIDDENSURPRISELATEST! 👉A Complete Infinity Nikki Code list (May 2026). Add @APKFreeDownloader_Bot to get any apk you want.

Hashtags

APKPure_Official

@apkpurechannel · Post #2955 · 11.04.2026 г., 11:21

🆓REDEEM CODES🆓 🚀🎁#Genshin Impact 6.5#Codes (April 2026) NEW CODE: FairyGirlLinnea ✨30 primogems, 20k mora, and three tattered warrans 🔗All the Working Genshin Impact 6.5 Codes Add @APKFreeDownloader_Bot to get any apk you want.

Hashtags

APKPure_Official

@apkpurechannel · Post #2920 · 22.03.2026 г., 11:00

🆓REDEEM CODES🆓 📌AFK Arena Redeem 🎁🚀#Codes Grab the latest codes for free diamonds and gold!! 💫CheerforAnniv - 500 diamonds and 20k gold (expires March 21, 2026) 💫AFKHomestead0130 - 200 diamonds and 20k gold (expires March 21, 2026) 🌟AFK Arena Code List Add @APKFreeDownloader_Bot to get any apk you want.

Hashtags

APKPure_Official

@apkpurechannel · Post #2846 · 31.01.2026 г., 11:00

🆓REDEEM CODES🆓 🚀🎁AFK Journey #Codes💎🧈 🧐⏳Two Codes Expired on January 29!! NEW CODES: 🎁【 Alna&AuroraBestGift 】🎁 Your rewards include 600 diamonds and 20,000 gold💎🧈!!! 🎁【 Alna&AuroraBestGift 】🎁 Your rewards include 200 diamonds and 20,000 gold💎🧈!!! 🕹️🎮Play AFK Journey on Android 📌👉All the Working AFK Journey Gift Codes Add @APKFreeDownloader_Bot to get any apk you want.afk

Hashtags

APKPure_Official

@apkpurechannel · Post #2838 · 25.01.2026 г., 11:01

🆓REDEEM CODES🆓 🚀💫AFK Journey 🎁#Codes | 📅January 2026 🎮Download & Play AFK Journey LATEST CODE:🎁【 Alna&Patch154AFK 】🎁 Your rewards include 300 diamonds💎 and 20,000 gold🧈!!! 📌Bookmark the AFK Journey code guide for more available gift codes: 👉All the Current AFK Journey Codes Add @APKFreeDownloader_Bot to get any apk you want.afk

Hashtags

APKPure_Official

@apkpurechannel · Post #2781 · 07.12.2025 г., 11:00

🆓REDEEM CODES🆓 ❣️🎁AFK Journey #Codes (UPDATED!) 📅December 2025 🎮Download AFK Journey on Android REDEEM CODE:【 📌AFKJPN153WithGala📌 】 💎🧈For 300x DIAMONDS and 20,000x GOLD!!! *Check back often for more redeemable AFK Journey gift codes!!! All the Latest AFK Journey Codes Add @APKFreeDownloader_Bot to get any apk you want.afk

Hashtags

APKPure_Official

@apkpurechannel · Post #2770 · 30.11.2025 г., 14:43

🆓REDEEM CODES🆓 ✨🕹️#Clash Royale Emote 🎁#Codes Gear up for the 👀Clash Royale #December 2025 update with the flying royale hogs emote and snoring dragon banner set: 📌【 WHENHOGSFLY! 】Working - flying royal hogs emote 📌【 REINABARRIGA 】Working - snoring dragon banner set Add @APKFreeDownloader_Bot to get any apk you want.

Hashtags

APKPure_Official

@apkpurechannel · Post #2751 · 16.11.2025 г., 14:01

🆓REDEEM CODES🆓 🪄🔮Wuthering Waves 2️⃣.8️⃣ Livestream #Codes Two New 🎥Livestreawm Codes for 🌟Wuthering Waves v2.8 version update: 🚀ENDLESSSUMMERNEW!!! 🎁Redeem for 100 astrite, three advanced resonance potions, and two medium revival inhalers 🚀CRUMBLEDCITYNEW!!! 🎁Redeem for 100 astrite, three advanced energy cores, and two medium nutrient blocks Redeem now and check your in-game email inbox for all your rewards! 🔗How to Redeem Wuthering Waves Codes 🕹️Download Wuthering Waves Latest Version Add @APKFreeDownloader_Bot to get any apk you want.

Hashtags

APKPure_Official

@apkpurechannel · Post #2604 · 19.08.2025 г., 11:00

🆓REDEEM CODES🆓 🎉🎉🎉YuYu Hakusho:Slugfest Is Lauching In 📍Europe!🔥🔮 🚀🚀🚀EU Server Release Time: ⏳8/20, at 10 AM!! Set Your Alarms!!!⏰🔔 ✨Two gift #codes. Tons of upgrade materials. For all YuYu Hakusho 📍EU fans:🎁🔮💎💰 👉【 apkpure0820 】👈 - Redeem for Crystal Bead *100, Currency *10,000, and Bond Scroll *1 👉【 apkpure2508 】👈 - Redeem for Crystal Bead *200 and Intermediate EXP Talisman *5 [ How to Redeem ] 1) To the Game Lobby. 2) Tap on your 📌Avatar. 3) Select 👆Redemption Code. 4) Redeem your 🎁Codes. 🎮🕹YuYu Hakusho:Slugfest Game Info & APK Download Add @APKFreeDownloader_Bot to get any apk you want.

Hashtags

APKPure_Official

@apkpurechannel · Post #2590 · 10.08.2025 г., 11:01

🆓REDEEM CODES🆓 👀Reverse: 1999 August 🎁#Codes 🎮Play Reverse 1999 v2.7 Update ✨【 EZIOXRE1999 】✨NEW!! - Get 19.9k dust, 19.9k dust, three fine insight casket, one picrasma candy ✨【 weareassassins 】✨NEW!! - Get three cicada wings, three prophetic scrolls, two silver bullters, five scroll containers, five bottle of pages, and one jar of picrasma candy 👉🎁View a complete Reverse: 1999 code list here. Add @APKFreeDownloader_Bot to get any apk you want.

Hashtags

123•••67
ПретходнаСтраница 1 од 7Следна