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

Резултати

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

Пребарај: #crdroid

当前筛选 #crdroid清除筛选
Xiaomi 12T Pro | K50U | Updates

@xiaomi_12tpro_updates · Post #153 · 12.09.2024 г., 17:15

#crDroid#diting New Version 10/09/2024: Gapped version Download Changelog: Updated to version 10.8 Note: Firmware is NOT included. Credits: Thanks to @TeamMEX_XDA for all his helps and providing dt By@Mohammadnt96

Xiaomi 12T Pro | K50U | Updates

@xiaomi_12tpro_updates · Post #120 · 12.07.2024 г., 14:25

#crDroid#diting New Version 11/07/2024: Gapped version Download Changelog: crDroid v10.6 Updated to June security patch Including MiuiCamera Note: Firmware is NOT included. This is beta version. Credits: Thanks to @TeamMEX_XDA for all his helps and providing dt By@Mohammadnt96 Follow@xiaomi_12tpro_updates Join@xiaomi_12tpro_chat

Xiaomi 12T Pro | K50U | Updates

@xiaomi_12tpro_updates · Post #84 · 26.02.2024 г., 21:12

#crDroid#diting New Version 25/02/2024: Gapped version Download Changelog: crDroid v10.2 SMS fixed Kernel Switched to HyperOS Used HyperOS blobs Notes: Use latest skkk twrp (v8.6) Credits: Thanks to @TeamMEX_XDA for all his helps and providing dt Discussion: Xiaomi 12T Pro crDroid

Xiaomi 12T Pro | K50U | Updates

@xiaomi_12tpro_updates · Post #63 · 02.02.2024 г., 03:40

#crDroid#diting New Version 02/02/2024: Gapped version Download Changelog: crDroid v10.1 fod fixed for both touchscreens miui camera included Known Issues: Opening photo in miui camera Credits: Thanks to @TeamMEX_XDA for all his helps and providing dt Discussion: Xiaomi 12T Pro crDroid

Xiaomi 12T Pro | K50U | Updates

@xiaomi_12tpro_updates · Post #17 · 11.11.2023 г., 00:57

#crDroid#Unofficial#diting#A14 Crdroid 10.0 UNOFFICIAL | Android 14 Updated: 11-11-2023 ▪️Download ▪️Support Changelog: • Initial A14 build with oss vendor Notes: Known Issues: Auto brightness must be disabled. otherwise screen will not wake after lock Fod on k50u does not work Credits: Thanks to @TeamMEX_XDA for providing dt By@Mohammadnt96 Follow@xiaomi_12tpro_updates Join@xiaomi_12tpro_chat

Xiaomi 12T Pro | K50U | Updates

@xiaomi_12tpro_updates · Post #14 · 10.11.2023 г., 01:58

#crDroid#Unofficial#diting#A13 Crdroid 9.10 UNOFFICIAL | Android 13 Updated: 05-11-2023 ▪️Download ▪️Support Changelog: • Initial Vendor OSS Build Credits: Thanks to @TeamMEX_XDA for providing dt By@Mohammadnt96 Follow@xiaomi_12tpro_updates Join@xiaomi_12tpro_chat

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #374 · 30.07.2024 г., 11:52

CrDroid - Official | Android 14 | Nothing Phone (2) 📝 Details: - Version: v10.6 - Status: #Official - Device: #Pong - Released: 30/07/24 ⬇️ Download: ROM (Vanilla) | Gapps Package 📔 Instructions: Here 🎄 Device tree : Here 📝 Changelogs : Here 🆘 Support: TG | XDA 🏷 Tags: #AOSP#ROM#CrDroid#U ✍️ Note: - Base firmware 2.6.0 is recommended - Dirty flash possible from previous july build - Report with logs if you found issues in the comment section below 🏆 Credits: - Chandu Dyavanapelli for DT Base - Hellboy for Meteoric kernel and Glyph changes - Fabian for PA Glyph Implementation 👤 Maintainer: @Ghosutox 🔔 Updates: @NothingPhone2Updates 🐙 Chat: @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #353 · 15.07.2024 г., 19:46

CrDroid - Official | Android 14 | Nothing Phone (2) 📝 Details: - Version: v10.6 - Status: #Official - Device: #Pong - Released: 15/07/24 ⬇️ Download: ROM (Vanilla) | Gapps 📔 Instructions: Here 🎄 Device tree : Here 🆘 Support: TG | XDA 🏷 Tags: #AOSP#ROM#CrDroid#U ✨Changelogs: - Initial QPR3 release ✍️ Note: - Base firmware 2.6.0 is recommended - Clean flash must - Report with logs if you found issues in the comment section below 🏆 Credits: - Chandu Dyavanapelli for DT Base - Hellboy for Meteoric kernel - Fabian for PA Glyph Implementation - Testing Team 👤 Maintainer: @Ghosutox 🔔 Updates: @NothingPhone2Updates 🐙 Chat: @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #296 · 15.05.2024 г., 14:18

CrDroid - Official | Android 14 | Nothing Phone (2) 📝 Details: - Version: v10.5 - Status: #Official - Device: #Pong - Released: 15/05/24 ⬇️ Download: ROM (Vanilla) | ROM Fastboot | Gapps 📔 Instructions: Here 🆘 Support: TG | XDA 💰 Donate: PayPal | BuyMeACoffee 🏷 Tags: #AOSP#ROM#CrDroid#U ✨Changelogs: - Update to CrDroid 10.5 - Added ParanoidGlyph - Fixed SMS and SIM issue ✍️ Note: - Base firmware 2.5.5 is recommended - Report with logs if you found issues in the comment section below 🏆 Credits: - Chandu Dyavanapelli for DT bring up and fix SMS issue - Hellboy017 for kernel - Pong TG Dev & Testing Team 👤 Dev: @DylanAkp 🔔 Updates: @NothingPhone2Updates 🐙 Chat: @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #242 · 08.02.2024 г., 22:58

CrDroid - Official | Android 14 | Nothing Phone (2) 📝 Details: - Version: v10.2 - Status: #Official - Device: #Pong - Released: 08/02/24 ⬇️ Download: ROM (Vanilla) | Gapps 📔 Instructions: Here 💬 Support Group: Here 🏛 XDA: Here 💰 Donate: PayPal | BuyMeACoffee 🏷 Tags: #AOSP#ROM#CrDroid#U ✨Changelogs: - Initial official build - Firmware removed - Rebased on NOS 2.5.2 - Added Reverse Wireless Charging - Switched to qcom telephony - Added Glyphify (An alternative app to ParanoidGlyph I made, more to come in future updates) ⛔️ Known Issues: - Issue with reception of SMS Enabling and disabling SIM card from settings fix the issue until the next boot ✍️ Note: - Base firmware 2.5.2 is recommended - Report with logs if you found issues in the comment section below 🏆 Credits: - Chandu_Dyavanapelli for DT bring up - Hellboy017 for kernel - Przekichane for DT & vendor fixes on A13 » A14 - Pong TG Dev & Testing Team 👤 Dev: @DylanAkp 🔔 Updates: @NothingPhone2Updates 🐙 Chat: @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #226 · 05.01.2024 г., 13:53

CrDroid - Unofficial | Android 14 | Nothing Phone (2) 📝 Details: - Version : v10.x - Status: #Unofficial - Device : #Pong - Released : 04/01/24 ⬇️ Download : ROM (Vanilla) | Gapps 📔 Instructions: Here 📸 Screenshots : Here 💬 Support Group : Here 🏛 XDA : Here 💰 Donate : PayPal | BuyMeACoffee 🏷Tags : #AOSP#ROM#CrDroid#U ✨Changelogs: - Rebased on NothingOS 2.5.1 - Fixed stutters - Fixed Face Unlock - More CrDroid settings implemented - Updated to Android QPR1 (Security patch December 2023) ✍️ Note: - Base firmware 2.5.1 is recommended - Report with logs if you found issues in the comment section below 🏆 Credits: - Chandu_Dyavanapelli for DT Bringup - Hellboy017 for kernel - Przekichane for DT and Vendor fixes on A13 » A14 - Pong TG Dev and Testing Team for all help 👤 Dev : @DylanAkp 🔔 Updates : @NothingPhone2Updates 🐙 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #216 · 18.12.2023 г., 14:30

CrDroid - Unofficial | Android 14 | Nothing Phone (2) 📝 Details: - Version : v10.x - Status: #Unofficial - Device : #Pong - Released : 18/12/23 ⬇️ Download : Rom (Vanilla) | Gapps 📔 Instructions: Here 📸 Screenshots : Here 🏛 XDA : Here 💰 Donate : PayPal 🏷Tags : #AOSP#ROM#CrDroid#U ✨Changelogs: - Intitial A14 build based ✍️ Note: - Please be on NOS 2.0.4 before flashing. (Not yet tested from 2.5.1) - Report with logs if you found issues in the comment section below 🏆 Credits: - Chandu_Dyavanapelli for DT Bringup - Hellboy017 for kernel - Przekichane for DT and Vendor fixes on A13 » A14 - Snuvig for early tests - Pong TG Dev and Testing Team for all help 👤 Dev : @DylanAkp 🔔 Updates : @NothingPhone2Updates 🐙 Chat : @NothingPhone2

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