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

Резултати

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

Пребарај: #galxe

当前筛选 #galxe清除筛选
UXLINK

@uxlink_community · Post #457 · 29.04.2025 г., 06:20

🚀 To celebrate the partnership with @AEON_Commuinty, the leading crypto payment framework, built for AI to drive intelligent, automated payments across Web3 and simplify how crypto works in real life, we're hosting a GIVEAWAY! 🎉Total $700 Up For Grabs! ⏰May 1st, 10:00 AM - May 20th, 10:00 AM (UTC) 1️⃣$200 raffle for qualified #Galxe participants 2️⃣$500 rewards via AEON Pay for TOP and FCFS consumers Consume $UXLINK to cover daily expenses (Each transaction must over $5). 👀Stay tuned for the upcoming announcement! In the meantime, feel free to take a sneak peek here 👉https://t.me/aeon_pay_bot

Hashtags

TON Capital ANN

@toncapital_official · Post #90 · 08.10.2024 г., 11:57

The competition is heating up, and it's time to take your skills to the next level in our #TON Capital #Galxe Campaign!⚡️ With more tasks, bigger rewards, and an even tougher playing field, the challenge is yours to conquer. 💪 Complete missions, accumulate points, and rise to the top of the leaderboards for your chance to claim extraordinary rewards. From challenges and quizzes to community actions, every task pushes you closer to victory. 🎁 The Best Will Be Rewarded: 🏆A $1000 USDT prize pool awaits the Lucky 100 on our Galxe campaign leaderboard 🏅Exclusive badges for the Lucky 500 contributors ( Galxe Explorer + Guaranteed Whitelist) 🎯Access to the Season 1 Expedition Grand Prize, worth up to $50,000 and 88.8m $TONCAP! Join TON Capital Galxe Campaign -- https://app.galxe.com/quest/SAw9YJRiY3VF2oevPJpa3K/GCWPWtKwCQ Show us what you’ve got and seize your opportunity to be part of something great in the world of TON and Web3. ⚡️The future is yours to shape!

Hashtags

Airdrop Gold : Crypto Airdrop

@airdropgoldchannel · Post #158042 · 10.09.2025 г., 12:17

🎉 Solana Leveling #Airdrop on #Galxe🎉 We’re giving away $5 to 10 lucky winners 💸 ✅ Complete simple social tasks ✅ Join the Solana Leveling community ✅ Stay updated with the best Solana insights 👉 Enter here:https://app.galxe.com/quest/AygxpG3nDj4VfTNkmsTrpN/GCUxJt6zNX

Online Earning 24

@onlineearning24riyad · Post #4185 · 27.02.2024 г., 16:53

Universal Health Token x GOQii 🌀Get claim free #NFT OAT + Early Users ➡️#galxe➡️https://galxe.com/UHT/campaign/GCdqpt4KkD?referral_code=GRFr2Jnia-mvXXQiJt8O8SeoXRMDMIS-z2m943IyVk_OQY4 - Complete all task (twitter, discord,...) - Claim NFT OAT + Points

Hashtags

TokenPocket

@tokenpocket_channel · Post #955 · 30.11.2023 г., 03:48

🆕 Galxe now fully supports #TokenPocket login! 👉https://extension.tokenpocket.pro/ Galxe is the leading platform for building the Web3 community. 🔥Follow TokenPocket Space and Get Ready for the #TokenPocketChristmas on #Galxe! 👉https://galxe.com/TokenPocket Details: 👉https://twitter.com/Galxe/status/1729918366012600584 👉https://twitter.com/TokenPocket_TP/status/1730068829311774726

⚡️Electra launches a quest on Galxe! We are pleased to announce that🚀Electra launches an exciting $ELT token reward campaign on the #Galxe platform! This means that Airdrop is just around the corner! 🏆 💵 As part of this campaign, you have the opportunity not only to earn $ELT tokens, but also to participate in prize draws in $USDT, unique NFTs and tokens from top partners🤝Electra! Complete quests, follow the news and get ready for the $ELT airdrop! ➡️Take part in the campaign #Electra#Airdrop#DeFi#Web3

Airdrop Comic

@airdropcomic · Post #2089 · 07.08.2025 г., 12:33

🔥Airdrop – Empeiria x Leap Wallet ✅ 💠Reward:Empe Micro Node (worth $50) – Grants access to EMPE token staking rewards. Claiming starts after TGE. ☀️Airdrop Link :- Click Here ⚙️How to Participate? ♦️Jointheevent on Galxe ♦️Complete all listed quests ♦️Connect your wallet & verify tasks ♦️Secure yourEmpe Micro Node reward 📌Note:Limited-time event – don’t miss your chance to get early staking access with Empeiria ®Note - Please do your own research (DYOR) before joining to any airdrops project, also airdrop is 100% free. Don't send any fee or penny for receiving airdrop tokens. #Empeiria#LeapWallet#Galxe#Airdropcomic#CryptoRewards#Web3