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

Резултати

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

Пребарај: #zetachain

当前筛选 #zetachain清除筛选
TokenPocket

@tokenpocket_channel · Post #1117 · 15.01.2024 г., 07:05

🟩Let's Share $150,000 in ZETA! ​zetablockchain 🎯Ready for an immersive experience with #ZetaChain Testnet before the mainnet launch and a chance for potential airdrops? JOIN NOW 👉https://tp-lab.tptool.pro/tokenpocket-christmas/?locale=en#/ ​Galxe 👉https://galxe.com/TokenPocket/campaign/GCc28ttYTk With such incredible projects, the anticipation for the #ZetaChain mainnet is booming! ​zetaswapdex ​LENX_Finance ​zkme_ ​UltiverseDAO ​SushiSwap ​ChatGM_Official ​CharacterXAI ​sugar_datingfi ​eddy_protocol ​TokenPocket_TP 【Details】https://twitter.com/TokenPocket_TP/status/1746790100393206137 【Powered By】Crypto Box

Hashtags

TokenPocket

@tokenpocket_channel · Post #801 · 20.09.2023 г., 08:55

🆕 ZetaChain Testnet is Now Live on TokenPocket! zetablockchain ▶️Supported by TokenPocket Mobile Wallet and Chrome Extension Wallet! TokenPocket now supports users to ✅ Custom add #ZetaChain Testnet to TokenPocket. ✅ Create & Import #ZetaChain wallets. ✅ Interact with #ZetaChain Testnet-based DApps. 🚀 Create your first #ZetaChain wallet on TokenPocket_TP! Use Guide👉https://help.tokenpocket.pro/en/wallet-operation/how-to-create-a-wallet/zetachain-testnet 👉https://www.tokenpocket.pro/ 👉https://extension.tokenpocket.pro/#/ 【Details】https://twitter.com/TokenPocket_TP/status/1704418412582338967 【Powered By】Crypto Box

Hashtags

TokenPocket

@tokenpocket_channel · Post #1166 · 01.02.2024 г., 04:04

🆕#ZetaChain is now live on ​TokenPocket_TP. ​zetablockchain 💚ZetaChain is a simple, fast, and secure Omnichain Blockchain. 🚀How to create/import a #ZetaChain wallet on #TokenPocket Mobile Wallet and Chrome Extension Wallet? Guide👉https://help.tokenpocket.pro/en/wallet-operation/how-to-create-a-wallet/zetachain Download #TokenPocket 👉https://www.tokenpocket.pro/ 👉https://extension.tokenpocket.pro/ #ZetaChain#TokenPocket $ZETA 【Details】https://twitter.com/TokenPocket_TP/status/1752905240133996845 【Powered By】Crypto Box

TokenPocket

@tokenpocket_channel · Post #1172 · 02.02.2024 г., 02:26

💥@​zetablockchain Ecosystem is booming!! 💚You won't want to miss a chance to share 1,000 #ZETA, right? Dive into👇 https://galxe.com/TokenPocket/campaign/GCEZRtwWpG 🎯How to create & import a #ZetaChain wallet on ​TokenPocket_TP? Full guide👇 (For mobile and Chrome extension users.) 【Details】https://twitter.com/TokenPocket_TP/status/1753242729960628260 【Powered By】Crypto Box

TokenPocket

@tokenpocket_channel · Post #1169 · 01.02.2024 г., 10:06

🆕#DAppListing This week we've listed 10 trending ​zetablockchain DApps on ​TokenPocket_TP! 💚DApps on ​zetablockchain: ​zetaswapdex ​eddy_protocol ​Owlto_Finance ​ZetaEarn ​LENX_Finance ​ZetaMarkets ​TransitFinance ​izumi_Finance ​SushiSwap ​CurveFinance Discover #ZetaChain with your #TokenPocket, more trending DApps will be listed soon!! 🔵All-in-one, All-in TokenPocket! 👉https://www.tokenpocket.pro/ 👉https://extension.tokenpocket.pro/#/ 【Details】https://twitter.com/TokenPocket_TP/status/1752996104243986700 【Powered By】Crypto Box

TokenPocket

@tokenpocket_channel · Post #1161 · 30.01.2024 г., 02:28

💥We’re excited to announce that #TokenPocketChristmas winners can claim rewards at @ZetaBlockchain mainnet launch! #ZetaChain Check if you are on the first-round winner list 👉https://docs.google.com/spreadsheets/d/1zqZx0BHE0gVBn8doFhRAdFBaQrwoxzPbwu2CYCOkvhs/edit#gid=0 How to claim your #ZETA? 1️⃣Download TokenPocket Wallet 👉https://tokenpocket.pro 👉https://extension.tokenpocket.pro 2️⃣Create/import/sync your #ZetaChain wallet on TokenPocket after mainnet launch! 3️⃣Share the news with your friends if you are on the winner list! (RT, Like, Comment) 👉https://twitter.com/TokenPocket_TP/status/1752147092942749951 When to get your ZETA? ⏰The rewards will be distributed at the same time of #ZetaChain airdrop claim opens this week. All participating user data from #TokenPocket are also whitelisted to get a boost in the first XP campaign on ZetaHub. Learn more about the 10% of the total ZETA token supply for community rewards: https://twitter.com/zetablockchain/status/1750758520637804707

Venture Village Wall 🦄

@venturevillagewall · Post #4204 · 21.02.2025 г., 01:00

AI Agent Launchpad Goes Live Zearn launches the world’s first Universal AI Agent launchpad using autonomous AI on ZetaChain’s infrastructure. Users can create meme narratives and deploy AI agents in just three clicks, leveraging real-time social sentiment for refinement. Read more here. Additionally, Utah's Bitcoin reserve bill has passed the Senate Revenue and Taxation Committee, marking a significant step for cryptocurrency regulation in the state. #AI#Crypto#Zearn#ZetaChain#Bitcoin#Blockchain#Utah#Innovation

TokenPocket

@tokenpocket_channel · Post #1167 · 01.02.2024 г., 04:42

Quoted TokenPocket_TP : 💥All the #TokenPocketChristmas rewards have been distributed to winners' TokenPocket #ZetaChain Wallet!! #HODL To celebrate the #ZetaChain Mainnet launched, TokenPocket provides 1,000 #ZETA to #TokenPocket users! Dive into👇 https://galxe.com/TokenPocket/campaign/GCEZRtwWpG#ZetaChain 😁Eligible for TokenPocket users, please create/import a #ZetaChain wallet on #TokenPocket Mobile Wallet and Chrome Extension Wallet? Guide👉https://help.tokenpocket.pro/en/wallet-operation/how-to-create-a-wallet/zetachain 【Details】https://twitter.com/TokenPocket_TP/status/1752914758746210773 【Powered By】Crypto Box