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 слични објави

Пребарај: #tycoongame

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

@singsingchannel · Post #1030 · 19.11.2024 г., 10:17

🚨 Sneak Peek Alert about $SING token🚨 Big changes are coming to Tycoon Game! 🎤✨ Soon, withdrawal fees will no longer be paid in TON. Instead, we’re switching to $SING! 💎 👉 Start stacking your $SING now to stay ahead! 🔑 Tips: 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#TycoonGame#GameFi#Web3

SingSing Announcement

@singsingchannel · Post #1065 · 02.12.2024 г., 06:40

🔧Tycoon Game Maintenance Notice🔧 Tycoon Game will be temporarily closed for maintenance starting at 7:00 AM UTC. We'll keep you updated on the reopening time. After this maintenance, SING will be integrated into the game as announced: https://t.me/singsingchannel/1050 Thank you for your patience and support! 🌟 #GameFi#TycoonGame#Maintenance

SingSing Announcement

@singsingchannel · Post #837 · 26.09.2024 г., 05:40

🚀 How to Play SingSing Tycoon: Step-by-Step Guide 🚀 1️⃣ Buy $KARA: Upgrade buildings and cashiers to boost Cash income! 🔝 2️⃣ Complete Missions: Invite friends for $KARA, RUBY, and potential Cash Back in TON. 💵 3️⃣ Purchase Lucky & Kara Boxes: Get KTV NFTs or $KARA. Daily sales on SingSing’s MarketPlace! 🛍 4️⃣ Unbox Items: Go to 'KTV Game', enter 'Vault', and claim your NFTs and $KARA. 5️⃣ Unlock Floors: Use KTV NFTs to create more karaoke rooms for increased Cash income. 💸 6️⃣ Equip Karaoke Box NFTs: Boost Cash income in karaoke rooms! 💰 7️⃣ Spend $KARA and Cash: Use for features like Lucky Spin and NFT Marketplace coming soon! 🎯 8️⃣ Join Club Competition: Earn Airdrop Vouchers convertible to $SING after TGE! 🌟 #SingSing#TycoonGame#PlayToAirdrop

SingSing Announcement

@singsingchannel · Post #790 · 10.09.2024 г., 10:00

🚨 3 hours to go until Lucky Box Session 2 sale! 💰 Price: ✅ 150 Boxes for All: 800 RUBY each ✅ 50 Boxes for Pioneer NFT Holders: 400 RUBY each 🗓 Sale Time: 13:00 UTC, Sep 10 You'll soon be able to claim your NFT because SingSing Tycoon game is launching very soon! 🎉Get ready to dive into the karaoke empire! 🎤 #SingSing#LuckyBox#NFTs#TycoonGame

SingSing Announcement

@singsingchannel · Post #831 · 25.09.2024 г., 07:39

🎤 How to Leverage Your NFTs in Tycoon Game 🎤 💥 Right now, you can equip both types of NFTs to boost your earnings! Dive into below: 1️⃣ Karaoke Box NFT 🔧 Boost earning speed in karaoke rooms from 1.5x to 8x (depending on rarity). Common ➡️ x1.5 earning speed Uncommon ➡️ x2 earning speed Rare ➡️ x4 earning speed Epic ➡️ x6 earning speed Legendary ➡️ x8 earning speed How to equip: - Tap the only 'Equip' button and select your Karaoke Box NFT. - After equipping, the NFT ID will appear as the room number. - To unequip, tap the 'Equip' button again, press '-' button to unequip NFT 2️⃣ KTV NFT 🔧 Unlock 1-15 new floors, adding more rooms and boosting your earnings! Common ➡️ +1 floor Uncommon ➡️ +3 floors Rare ➡️ +5 floors Epic ➡️ +10 floors Legendary ➡️ +15 floors How to equip: - Tap 'New Floor,' select your KTV NFT, and you're all set! - New floors will unlock, with the NFT image displayed above the highest floor. - To unequip, tap the KTV NFT image and press 'Unequip'. #NFT#KTV#SingSing#Tycoongame

SingSing Announcement

@singsingchannel · Post #1085 · 06.12.2024 г., 08:20

🎉KARA Launchpool has officially ended!🎉 Congrats to all stakers for earning huge rewards from the 1,000,000 KARA pool! 🏆 It’s time to redeem your rewards now: D 1️⃣ Tap Detail Pool2️⃣ Hit the Redeem button 3️⃣ Confirm the transaction in Metamask4️⃣ Check your KARA balance in Tycoon Game and keep using $SING to join the AURA Launchpool! 🚀 The journey doesn’t stop here. Let’s keep thriving! If you want more $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) #KARA#Launchpool#TycoonGame#Web3Gaming

SingSing Announcement

@singsingchannel · Post #797 · 12.09.2024 г., 10:19

🎉 Why Own a Tycoon Lucky Box? 🎉 1️⃣ The Tycoon Box is your chance to get early NFTs at a cheap price, purchasable with free RUBY you’ve mined 💎 2️⃣ Claim your NFTs right after the SingSing Tycoon game launch 🚀 3️⃣ These NFTs will be key to boosting your income fast in the new game 💰 4️⃣ Trade your NFTs freely on our Marketplace 📈 Note 🤫: We are still selling session 2 with less than the last 100 Boxes left, grab them now🎁 #SingSing#LuckyBox#NFT#RUBY#Tycoongame