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

Резултати

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

Пребарај: #bitmart

当前筛选 #bitmart清除筛选
NEWS 鏈新聞-ABMedia

@abmedia_news · Post #24241 · 30.04.2026 г., 07:00

【🚀贊助文章|BitMart 幣市 8 週年晚宴:為台灣用戶導入 AI 自動化交易與在地化服務】 #BitMart 📍閱讀全文: https://abmedia.io/bitmart-8th-anniversary-ai-trading 📍 訂閱鏈新聞頻道:https://linktr.ee/abmedia.io

Hashtags

Airdrop Strikers™

@airdropstrikers · Post #823 · 02.12.2022 г., 05:56

➡️➡️👍💎➡️➡️✨Upcoming New Listing ✨ 🤿🚟 #BitMart will list $BST @bstokens_official Blue Sapphire Token soon!🎉 👌👌👌👌👌👌👌 📢 Follow our official announcement for more details! 👀 ✅✅✅ ⬇️Share in the comments what you like about this project! #$BSTBitMartListing 🔎🔎🔎🔎🔎✅✅ https://www.pinksale.finance/launchpad/0xE61682795028383edE69bD9f609dA0021A372242?chain=BSC ✅✅✅✅✅ Blue Sapphire Tokens 🪙 Unique Crypto Currency Backed By Precious Gem Stones 💎 ⚡Big Announcements on the Go.⚡ *Presale in upcomming days on pinksale* Congratulations to BsT community. 👉 Don't forget to tell your friends. Safe place for investors in the crypto space and we Strongly believe in Honesty, Transparency, and Integrity. 🟩🟥🐈‍⬛🟩 🟢 Web 3.0 🟢 Metaverse Universe 🟢 Sapphire Browser 🌍 🟢 Sapphire Cross Chain wallet. 🟢 Saphex Exchange 💱 🟢 High APR Staking pools 🟢 Rare NFTs, 🟢 KYC and Audit. https://twitter.com/Bstgroupworld 🔤🔤🔤🔤🔤🔤🔤🔤https://t.me/bstokens_official Website: bstokens.com Whitepaper https://t.me/bstokens_official/3

Hashtags

LOS Community

@losgamecoin · Post #78 · 23.10.2024 г., 15:19

🌟 Upcoming New Listing 🌟 🤩#BitMart will list LOS @losgamecoin soon! Keep an eye on our socials for further announcements. Share in the comments what you like about this project 👇 #LOSBitMartListing 🖤https://x.com/BitMartExchange/status/1849094936307589139

​​🎙 Cruize Finance MOON SHEET announcement Protected Yields Through Stormy Markets With Cruize, your assets remain safe from volatility risks while generating outsized returns in every market condition @CruizeFinance, single sided yield farming protocol on @arbitrum, protecting users from market volatility. Cruize Finance new listing date is now set for July 18th. Cruize Finance working round the clock to ensure we're shipshape for the journey ahead. ✅ Benefits of using Cruize 1️⃣ Supports a wide range of digital currencies across various blockchain networks. 2️⃣ Superior risk-return profiles make it easy for almost anyone to grow their portfolio and earn big. 3️⃣ Allowing for easy portfolio management with added security features like multi-sig. 4️⃣ Track your assets with precision using our intuitive dashboard and get instant access to real-time data. 5️⃣ Publicly accessible code and verifiable on-chain data ensures transparency and security. 6️⃣ A user-friendly interface with options for different users, tailored to meet their specific requirements. ✅About DCruize Finance token metric - Token name: #CRUISE - IDO price: 0,1111$ - Initial price: 0,1111$ - Total Supply: 100,000,000 $CRUISE - Listing: 17 July ✅ Follow Project Media 1️⃣Website 2️⃣Twitter 3️⃣Discord #CRUISE#UNISWAP#BITMART#IDO

⚡️𝗣𝗮𝗿𝘁𝗻𝗲𝗿𝘀𝗵𝗶𝗽 𝗔𝗻𝗻𝗼𝘂𝗻𝗰𝗲𝗺𝗲𝗻𝘁 ⚡️ ᶜʳʸᵖᵗᵒ ¹⁰⁰ˣ ⱽ ᴹᵃʳˢᵒ ᵒⁿ ᴱᵀᴴ ⁽ ᴮᵃˢᵉ ⁾🔹 Marso Token: The Next BIG Thing in Crypto is Here! 🔥🔥🔥 🚀 The new BIG thing in the crypto market is here: Marso Token is launching, and it’s coming in HOT! Ready to soar, Marso Token is set to redefine possibilities in the crypto universe. 🫡🫡🫡 Join our journey, follow all our socials, stay tuned for the latest updates, and don’t miss your chance to invest early! ⭐️⭐️⭐️⭐️⭐️ 🤑🤑🤑 Get in on the action now—exclusively on BitMart! Let’s make history together with Marso Token. 🥰🥰🥰 🤩🤩🤩🤩 Join the Marso community for exciting news, contests, and more. This is only the beginning, and you’re invited to be part of it. 🤟🤟🤟 ✅Website: marso.tech ✅Telegram: https://t.me/MarsoUniverseCommunity 🚀X: https://x.com/marsouniverse?s=21 📱Instagram: https://www.instagram.com/marsouniverse?igsh=ZjR4cW5vZXVpdmMy&utm_source=qr #MarsoToken#CryptoLaunch#BiggestCrypto#InvestNow#CryptoCommunity#Bitmart#MarsoUniverse#AltcoinSeason#CryptoFuture#BlockchainInnovation#EarlyInvestors#CryptoBuzz#NextBigCoin#FutureOfFinance#MarsoToTheMoon