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

Резултати

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

Пребарај: #giveaway

当前筛选 #giveaway清除筛选
KICKSPAPER

@KICKSPAPER · Post #16007 · 20.07.2025 г., 12:04

Лето в разгаре, и мы решили: Почему бы не раздать то, что вы любите больше всего? FRHT #GIVEAWAY Разыгрываем 10 футболок из новой коллекции FRHT 🔥 Условие участия простое — Подписаться на этот канал 🏁 *если ещё не с нами Мы случайным образом выберем 10 победителей и отправим выбранные футболки Итоги 25 июля. Поехали 🚀

Hashtags

🎁Airdrops Info🎁

@crypdrops · Post #9080 · 23.08.2024 г., 14:19

🎉Bitget Wallet x All At Once #Giveaway🎉 🕙Event duration: August 23 - August 30, 2024 💰Rewards: 🚀$3,000 worth of TON for 300 lucky participants🚀 5M xAAO prize pool is shared equally among all participants How to join: 1️⃣ Follow @BitgetWallet + @AAO_Game 2️⃣ Join the AAO & Bitget Wallet Telegram groups: 3️⃣ Join the All At Once Bot and complete one game battle 4️⃣ Fill out the Google form to receive your reward

Hashtags

Papers Wallpapers

@androidwalls · Post #3510 · 27.08.2025 г., 11:33

🚀 Material Widgets - Everything is Now Available. Grab it today 👉✨ Special Launch Offer https://play.google.com/store/apps/details?id=com.jndapp.material.widgets.pack 🎁#Giveaway 15 Promo Codes ♥️, repost, and comment to Participate. Join Giveaway 🔥

Hashtags

ArrowWalls Wallpapers

@arrowwalls · Post #2270 · 27.08.2025 г., 11:33

🚀 Material Widgets - Everything is Now Available. Grab it today 👉✨ Special Launch Offer https://play.google.com/store/apps/details?id=com.jndapp.material.widgets.pack 🎁#Giveaway 15 Promo Codes ♥️, repost, and comment to Participate. Join Giveaway 🔥

Hashtags

APKPure_Official

@apkpurechannel · Post #2225 · 14.02.2025 г., 06:24

💝GAMEWTB Valentine's Day Giveaway - Steam Gift Card💝 Happy Valentine’s Day!💖 As a token of our appreciation for your continued support, the GAMEWTB TEAM has prepared a special gift🎁 for you. 💸Prize: $5 Steam Gift Card 📅FROM NOW - FEB 17, 2025 =How to Participate= 📲Follow our X: x.com/PC_Gamewtb ❤️♻️LIKE & RETWEET THIS POST☝️ ⏰Winner will be announced on Feb 17th ✅COMMENT "DONE" UNDER THIS POST☝️ 👀Wait our DM💌 Limited Time Event – Don’t Miss Out! 🤩Whether you're spending Valentine’s Day solo or with a special someone, remember to love yourself! GAMEWTB will keep bringing you the latest game news and exciting events. Join Gamewtb Group for GIVEAWAYS! #GIVEAWAY

Hashtags

💚🍀🌱 FARMERS, LISTEN UP! 💎✨ One of the LAST chances to grab OG role 🎖 and it’s about to go CRAZY 😤🔥 We're dropping a massive GIVEAWAY 🎁 /w 30 winners EACH GETS 0.1 SOL 🤑 + OG 👑 How to join: 1. Join our X (Twitter) https://x.com/ggpweb3 2. Join our Discord https://discord.gg/gg-paradise 3. Leave wallet in #giveaway channel 4. Stay active on server Results in Friday 🕶 Let’s make it loud before the farm goes wild 🌿🚀

Hashtags

TokenPocket

@tokenpocket_channel · Post #1618 · 28.05.2025 г., 11:13

💥500 QUACK AI NFTs and 200,000 QUACK Points Giveaway to TokenPocket users! 👉https://app.galxe.com/quest/TokenPocket/GC6YCtmDkS 🍾500 lucky winners will each receive a QUACK AI NFT! 🎯 Winners will also be eligible to earn an extra 400 points by interacting with the QUACK AI platform. #giveaway

Hashtags

Airdrop Presents 🗽

@airdrop_presents · Post #1616 · 03.06.2022 г., 07:06

💧Airdrop : Lifestory💧 📣Complete Task: ➕ $6000 #Giveaway - 4 Days contest 🏆Winners: For All Valid Users 📅End date: After 4 Days 💎Ratings: ⭐️⭐️⭐️ 🔛Galaxy Airdrop Gleam Click Here🔛 🌀 Follow on Twitter and retweet the pinned post. 🌀 After Done Airdrop Task then Create your wallet. 📡Enter your information to the Airdrop Gleam. 🗞Note: All airdrop steps should be completed. ⛵️Business Inquiry: Admin || Admin2

Hashtags

TokenPocket

@tokenpocket_channel · Post #1076 · 04.01.2024 г., 08:20

💥Big Congrats! 🏆Check if you are on the ZoomManor #Giveaway Winner List! 👉https://docs.google.com/spreadsheets/d/1QQ1rdc3jnt6BAhWL_8qhJJe56KyxSqF8BvCk21dLvSk/edit#gid=0 🎁The rewards will be distributed by ZoomManor before Jan 5th. ZoomManor 💙Thank you all very much for your participation! If you have any questions, you can join TokenPocket's Telegram to get more info. 👉https://t.me/tokenPocket_en

Hashtags

Airdrop365

@airdrop365official · Post #933 · 27.10.2022 г., 07:09

🪂New airdrop: FOBOCLUB x MEXCGlobal Collab Event #giveaway 💰Reward: 50 FOBO CLUB WLs (NFT) 📅Distribution: uncertain 🔗Airdrop Link: airdrop page 🔹Complete all tasks of the airdrop Disclaimer: Airdrop is 100% free. Don't send any fee or penny for receiving airdrop tokens. Just join airdrop for free!

Hashtags

Airdrop365

@airdrop365official · Post #894 · 03.10.2022 г., 15:25

🪂Airdrop: Mystery Box #Giveaway 💰Reward: $3,000 👨‍💼 Winner: All participants 📅 TIME:10/03/2022 07:00 AM - 10/09/2022 11:00 PM UTC 🔗Airdrop Link: airdrop page 🔹Complete all tasks of the airdrop Disclaimer: Airdrop is 100% free. Don't send any fee or penny for receiving airdrop tokens. Just join airdrop for free!

Hashtags

123•••10•••1920
ПретходнаСтраница 1 од 20Следна