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

Резултати

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

Пребарај: #derpfest

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

@xiaomi_12tpro_updates · Post #96 · 15.03.2024 г., 04:11

¡New build available! HOTFIX #DerpFest | #Official#diting Device:Xiaomi 12T Pro | Redmi K50 Ultra Sha256SUM: Build Date:2024-03-14 Downloads: Link |Mirror Changelog: - Fix jitter issues - improve brightness + auto brightness - improve performance and fix some fastcharge issues - Introduce optional haptic feedback everywhere - Add Custom Carrier Label & Carrier Label Placement - Add Screen off animations - Add lockscreen charging info switch - Fix battery stats not resetting - Fixup Screenshot sound - Settings: Re-organize sound settings - Settings: Add QS tile for refresh rate indicator to dev settings - ThemePicker: Add UI Styles - DerpSpace: Add missing summaries to listpreferences - DerpSpace: Disable settings for gravity and mirroring, when no pulse is enabled Notes • Gapps are included • Remebering, Don't report bugs without logs. • CTS pass by default By @TeamMEX_XDA Donate PayPal

Xiaomi 12T Pro | K50U | Updates

@xiaomi_12tpro_updates · Post #81 · 23.02.2024 г., 23:16

¡New build available! #DerpFest | #Official#diting Device:Xiaomi 12T Pro | Redmi K50 Ultra Sha256SUM:0494a40a694ff691f69401839dd683 Build Date:2024-02-23 Downloads: Link |Mirror Changelog: - BUILD HOTFIX - https://t.me/xiaomi_12tpro_updates/79 Notes • Gapps are included • Remebering, Don't report bugs without logs. • CTS pass by default By @TeamMEX_XDA Donate PayPal

Xiaomi 12T Pro | K50U | Updates

@xiaomi_12tpro_updates · Post #79 · 23.02.2024 г., 04:49

¡New build available! #DerpFest | #Official#diting Device:Xiaomi 12T Pro | Redmi K50 Ultra Sha256SUM:fcc1f00c1b95a94db388c5acadbb Build Date:2024-02-22 Downloads: Link |Mirror Changelog: - Reimplement Custom headers feature from Bootleggers - Allow to skip confirmation in biometric auth dialog - Tint app name in notifications with app icon color - Extend showing Ambient instead of fully waking to single tap gesture - Fix wakeup and long-press actions of assistant key - Gesture nav: Remove timeout setting and minor improvements - Few layout fixes for advanced reboot options - Add faster qs tile animation speeds - Fix premature short-circuit on end spring anim - Fix crash on notification icon contrast calculation - Upgrade blobs to HyperOS CN miui_DITING_OS1.0.24.1.8.DEV_8704513c97_14.0 - adjust vibration - upgrade kernel and modules to OS1.0.2.0.ULFCNXM Thnks to @Mohammadnt96 Notes • Gapps are included • Remebering, Don't report bugs without logs. • CTS pass by default By @TeamMEX_XDA Donate PayPal

Xiaomi 12T Pro | K50U | Updates

@xiaomi_12tpro_updates · Post #66 · 04.02.2024 г., 04:09

¡New build available! #DerpFest | #Official#diting Device:Xiaomi 12T Pro | Redmi K50 Ultra Sha256SUM:1ec96f10def7980fae0eb6ed2af22900e4c5138dc70a612e7c5d89fcbb0a2a48 Build Date:2024-02-03 Downloads: Link | Changelog: - Fixed miui camera issues (Still cant be open photos from the app use google photos) - Implement UDFPS animations (inside theme picker -> lockscreen) - Adjust udfps size - fix issue where rebooting to twrp or similar the device panics to fastboot - Fixed eSIM issues (now eSIM should work without more problems) - Implement parallel space - sync more stuff from derp - Change vibration effects thnks to @Mohammadnt96 Notes • Gapps are included • Remebering, Don't report bugs without logs. • CTS pass by default By @TeamMEX_XDA Donate PayPal

Xiaomi 12T Pro | K50U | Updates

@xiaomi_12tpro_updates · Post #57 · 31.01.2024 г., 19:09

¡New build available! #DerpFest | #Official#diting Device:Xiaomi 12T Pro | Redmi K50 Ultra Sha256SUM:1c0afa2bb789c3ed4645ef7cbd5301133f754c1f7e39fe8da88dc002a0c0df26 Build Date:2024-01-30 Downloads: Link | Changelog: Links Notes • Gapps are included • Remebering, Don't report bugs without logs. • CTS pass by default By @TeamMEX_XDA Donate PayPal

Xiaomi 12T Pro | K50U | Updates

@xiaomi_12tpro_updates · Post #53 · 24.01.2024 г., 15:53

¡New build available! #DerpFest | #Official#diting Device:Xiaomi 12T Pro | Redmi K50 Ultra MD5SUM:970d09393b9f120f9994f6e70e84745f Build Date:2024-01-24 Downloads: Link | Changelog: - Last derp changes - fixup thermal configurations Notes • Gapps are included • FOD Not working on gtx8_spi touch screen • Remebering, Don't report bugs without logs. • CTS pass by default • Flash hyperOS fw V816.0.23.12.11.DEV By @TeamMEX_XDA Donate PayPal

Xiaomi 12T Pro | K50U | Updates

@xiaomi_12tpro_updates · Post #46 · 03.01.2024 г., 01:51

¡New build available! #DerpFest | #Official#diting Device:Xiaomi 12T Pro | Redmi K50 Ultra MD5SUM:9160f4523ecdf942812112da9716fd3b Build Date:2024-01-02 Downloads: Link | Changelog: - sync latest source Notes • Gapps are included • FOD Not working on gtx8_spi touch screen • Remebering, Don't report bugs without logs. • CTS pass by default • Flash hyperOS fw V816.0.23.12.11.DEV By @TeamMEX_XDA Donate PayPal

Xiaomi 12T Pro | K50U | Updates

@xiaomi_12tpro_updates · Post #43 · 29.12.2023 г., 03:17

¡New build available! #DerpFest | #Official#diting Device:Xiaomi 12T Pro | Redmi K50 Ultra MD5SUM:9160f4523ecdf942812112da9716fd3b Build Date:2023-12-27 Downloads: Link | Changelog: - add missing media codecs - (WIP) Enable xiaomi vibrator effects - update carrier config from diting 14 UKQ1.230917.001 V816.0.23.12.11.DEV - Update blobs from hyperOS UKQ1.230917.001 V816.0.23.12.11.DEV - Add custom screen resolution setting Notes • Gapps are included • FOD Not working on gtx8_spi touch screen • Remebering, Don't report bugs without logs. • CTS pass by default • Flash hyperOS fw V816.0.23.12.11.DEV By @TeamMEX_XDA Donate PayPal

Xiaomi 12T Pro | K50U | Updates

@xiaomi_12tpro_updates · Post #40 · 21.12.2023 г., 06:22

¡New build available! #DerpFest | #Official#diting Device:Xiaomi 12T Pro | Redmi K50 Ultra MD5SUM:97bed4a62116ae1abcf4211b3ac9a5a2 Build Date:2023-12-20 Downloads: Link | Changelog: - Merge QPR1 (aka December security patch) - Remove OOS style clear all button toggle due to QPR1 conflicts - Switch to Yaap's impl for battery icon customizations - Switch to AOSP themepicker to fix wallpaper apply button and other small issues - Add DerpFest Updater (based on Lineage updater) - Fix for Faceunlock needing a reboot to work after registering a face model - Add optional bouncer user switcher toggle - Add option to display data disabled indicator icon - DerpSpace: Add a secure section to quick settings - DerpLauncher:Import Lawnicons - Update Gramophone prebuilt - Switch to ARMv9 and Cortex-A510 optimizations - Sepolicy enforcing Notes • Gapps are included • FOD Not working on gtx8_spi touch screen • Remebering, Don't report bugs without logs. • CTS pass by default By @TeamMEX_XDA Donate PayPal

Xiaomi 12T Pro | K50U | Updates

@xiaomi_12tpro_updates · Post #33 · 25.11.2023 г., 15:37

¡New build available! #DerpFest | #Official#diting Device:Xiaomi 12T Pro | Redmi K50 Ultra MD5SUM:5b8c26aeef4d9f418db9c4cbdfe48833 Build Date:2023-11-25 Downloads: Link | Changelog: - Fixed performance degradations - Fixed dolby atmos issues - Update props from stock - Reset FOD blobs to DITING_V14.0.10.0.TLFCNXM - Dont allow to run foreground process con CPU7 Notes • Gapps are included • FOD Not working on gtx8_spi touch screen • Remebering, Don't report bugs without logs. By @TeamMEX_XDA Donate PayPal

Xiaomi 12T Pro | K50U | Updates

@xiaomi_12tpro_updates · Post #31 · 22.11.2023 г., 05:42

¡New build available! #DerpFest | #Official#diting Device:Xiaomi 12T Pro | K50 Ultra MD5SUM:166b3c96ba79207e8e2295621661c3aa Build Date:2023-11-22 Downloads: Link | Changelog: - FOD issue should be fixed now - fixed battery styles - now fod is called again biometrics and not pixel imprint - fixed some crashed on derpspace (general is still empty) - Sync with last derp source Notes • Gapps are included • Fod not working on gtx8_spi devices • Remebering, Don't report bugs without logs. Know bugs: - Screen record - Fod on gtx8_spi - sepolicy permissive (not a bug but u know some call it as bug) By @TeamMEX_XDA Donate PayPal

Xiaomi 12T Pro | K50U | Updates

@xiaomi_12tpro_updates · Post #28 · 20.11.2023 г., 04:50

¡New build available! #DerpFest | #Official#diting Device:Xiaomi 12T Pro | K50 Ultra MD5SUM:0d85ed43a99f92be27b9fe9ae6a6e9be Build Date:2023-11-19 Downloads: Link | Changelog: - Fixed brightness issue - update advanced_sf_offsets to V816.0.10.0.UNBCNXM (SM8650) - enable gpu profiler - switch to ARMv9 - add missing props from stock - bug fixes - Update yuki kernel to 5.10.185 - Sync with last derp source Notes • Gapps are included • Fod not working on gtx8_spi devices • Remebering, Don't report bugs without logs. By @TeamMEX_XDA Donate PayPal

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