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

Резултати

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

Пребарај: #mysticgarden

当前筛选 #mysticgarden清除筛选
SingSing Announcement

@singsingchannel · Post #1166 · 14.01.2025 г., 05:18

🔥Get Ready, Blacksmiths!🔥 ⚒️Top Blacksmiths Event #2 is coming soon! The challenge? Forge the most Pots to climb the leaderboard and claim amazing rewards! 💎 🏆 Example Scoring: • Forge 3 Pots = 3 points ➡️ Total = 5 points 🎉Rewards: Top 50 Blacksmiths will share 150,000 AURA + $100 $SING!🎉 🥇Top 1: 25K AURA + $20 $SING 🥈Top 2: 15K AURA + $15 $SING 🥉Top 3: 10K AURA + $10 $SING 🏅Top 4-10: 5K AURA + $5 $SING each 🏅Top 11-20: 3K AURA + $2 $SING each 🏅Top 21-30: 2K AURA 🏅Top 31-40: 1K AURA 🏅Top 41-50: 500 AURA ⏰Event Duration: Jan 15, 14:00 UTC - Feb 5, 14:00 UTC Forge more, rank higher, and earn big! 💥 #TopBlacksmiths#MysticGarden

SingSing Announcement

@singsingchannel · Post #1161 · 09.01.2025 г., 12:39

🌟 Exciting News! 🌟 The Map feature is NOW LIVE on Mystic Garden! 🗺✨ 🌿 Claim your land 🌸 Build & grow multiple gardens 🔍 Track everything seamlessly on the map 💡 It’s time to create your very own Mystic World! Ready to explore? 🚀 #MysticGarden#GameFi#NFTGaming 🎤Announcement| Mystic Garden Game |Chat| Spotlight Channel

SingSing Announcement

@singsingchannel · Post #1057 · 27.11.2024 г., 13:00

🚀 SingSing Launchpool: Mystic Garden is Live! 🎉 🌟 Stake $SING, Earn AURA – The In-Game Currency of Mystic Garden Game! 🌟 💰 Launchpool Overview: - Total Rewards: 1,000,000 AURA - Period: Nov 27, 13:00 – Dec 23, 12:59 (UTC) 💎 Staking Details: - Minimum Stake: 500 $SING - Maximum Stake: 20,000 $SING - Rewards are settled every hour based on your staked $SING share. 🎮 What’s $AURA? AURA is the in-game currency for Mystic Garden, used to unlock premium upgrades, enhance gameplay, and claim exclusive rewards. Note: Mystic Garden Game is coming soon, grab the early bird chance to get AURA before game launching. 👉 How to Join: 1️⃣ Prepare your $SING tokens (at least 500 $SING to participate). 2️⃣ Stake your $SING in the Launchpool. 3️⃣ Get your AURA rewards automatically after Mystic Garden Game Launching! Note: If you have not got $SING, easily buy at: - BingX: https://bingx.com/en/spot/SINGUSDT/ - CoinEx: https://www.coinex.com/en/exchange/sing-usdt #SingSing#MysticGarden#Launchpool

SingSing Announcement

@singsingchannel · Post #1082 · 06.12.2024 г., 04:42

🌌✨ The Enchanted Call of Mystic Garden ✨🌌 Step into a world of wonder, where whispers of treasures await… ✨ AURA shimmers in the misty air. 🔮 Mystical quests hide secrets only the brave can unveil. 🌺 What lies beyond the garden gates? 🌿 A journey to uncover legendary rewards. ✨ Power your AURA and unlock the magic within. 🌌 The Mystic Garden awaits its chosen one. Will it be you? 🌸 ⏳ Time is fleeting – answer the call now. Join AURA Launchpool to early access to Mystic Garden: https://t.me/SingSing_TG_bot/app?startapp=_launchpool If you have not got $SING, easily buy at: - BingX: https://bingx.com/en/spot/SINGUSDT/ - CoinEx: https://www.coinex.com/en/exchange/sing-usdt - SingSing Mini App: https://t.me/SingSing_TG_bot/app?startapp=_wallet (guideline) #MysticGarden#FantasyAdventure

SingSing Announcement

@singsingchannel · Post #1133 · 24.12.2024 г., 12:51

🌟 Welcome to Mystic Garden 🌟 🌱 What to do? 1️⃣ Grow Your Garden: Plant seeds, harvest Crystals, and sell them for GOLD to upgrade your garden. 🌺💰 2️⃣ Complete Tasks & Events: Earn AURA, the most magical reward in Mystic Garden! 🪙✨ 3️⃣ Unlock Secret Chests: Open Chests to reveal surprise rewards and treasures! 🎁✨ 4️⃣ Elemental Forge: Craft powerful Pots and rare ELFs to strengthen your garden. 🔥🌟 5️⃣ Expand & Upgrade: Unlock new areas, upgrade your garden, and grow your magical empire. 🌳🏡 6️⃣ Invite Friends: Earn 20 AURA + cashback rewards when your friends join the fun! 🤝 🏆 What to Compete? ✔️Top Merchant: Sell the most Crystals and rule the market! 💰 ✔️Top Pot: Own the rarest and most powerful Pots. 🌟 ✔️Top Forger: Craft the most Pots/ELFs in the game! 🔥 ✔️Top Referral: Be the ultimate community builder by inviting the most friends! 🤝✨ Are you ready to rise to the top? 🌸 #MysticGarden#PlayToEarn#Web3Gaming 🎤Announcement| Mystic Garden Game |Chat | Spotlight Channel

SingSing Announcement

@singsingchannel · Post #1062 · 29.11.2024 г., 07:22

💎 MYSTIC GARDEN: UNIQUE FEATURES 🌱 • 6 Elemental Plant Types to grow & harvest. • Craftable Magic Pots & Elves for strategic boosts. • Daily AURA Rewards to keep the magic flowing. • Special Event Seasons with exclusive prizes. Unlock a magical gaming experience like no other! 🚀 #MysticGarden#GameFi#NFTGaming#SingSing

SingSing Announcement

@singsingchannel · Post #1054 · 26.11.2024 г., 08:00

🌟 Big Reveal: Mystic Garden is Coming! 🌟 SingSing is launching a brand-new game, Mystic Garden, alongside an exciting Launchpool opened tomorrow Nov 27 - 13:00 UTC! 🚀 🎮What is Mystical Garden? A magical game where you grow rare elemental plants, craft NFTs, and compete for leaderboard rewards while earning BNB and other rewards! 🌱💎 Stay tuned for more details—magic meets GameFi soon! ✨ #SingSing#MysticGarden#GameFi#Launchpool 🎤Announcement | Chat | X (Twitter) | Website | Game

SingSing Announcement

@singsingchannel · Post #1123 · 20.12.2024 г., 10:46

🌸Beta Test Closing Announcement🌸 The Mystic Garden Beta Test has officially ended! 💎 Thank you to all the players who participated and helped shape the game. 🌱 🏆Winners List and rewards will be announced soon. Stay tuned for updates! 🚀 #MysticGarden#BetaTest#Web3Gaming

SingSing Announcement

@singsingchannel · Post #1107 · 14.12.2024 г., 10:27

🚨 Mystic Garden Beta Test Reward Alert! 🚨 🌿 Dive into the enchanting world of Mystic Garden and claim your share of $500 AURA in rewards! 🌟 🎮 Beta Testers Wanted 💎 Exclusive prizes await 🌌 ⏳ Don't miss the magic—beta testing opens soon! #MysticGarden#BetaTest#Rewards

SingSing Announcement

@singsingchannel · Post #1063 · 30.11.2024 г., 04:32

🌿 Curious about Mystic Garden? The wait is almost over... 🌟 ✨ Be among the first to step into this magical world! 👉 Join AURA Launchpool now and secure your exclusive ticket to explore Mystic Garden! AURA Launchpool 🔗https://t.me/SingSing_TG_bot/app?startapp=_launchpool #MysticGarden#Launchpool#SingSingGaming

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