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

Резултати

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

Пребарај: #tonnel

当前筛选 #tonnel清除筛选
TONlines – News

@tonlines · Post #7477 · 15.11.2025 г., 13:45

Tonnel Network: Withdrawal Fees Maintained #TON#Tonnel Tonnel Network announces that their withdrawal fee will remain at 0.1 TON, offering a free withdrawal option when purchasing a gift worth over 6 TON. Despite potential losses, the service fee will not be increased. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #7457 · 30.05.2025 г., 13:05

⚡️Tonnel Network: Insights on Pre-Market Resale #Tonnel#TON Tonnel Network introduces an update to its Pre-Market system, allowing users to resell purchased gifts without collateral. Users can now list gifts at a higher price, and the original resale conditions ensure a secure transaction for all parties involved. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #7454 · 30.05.2025 г., 12:42

⚡️Tonnel Network: New Updates in Pre-Market V2 #Tonnel#TON Tonnel Network now allows users to resell gifts purchased on the Pre-Market with immediate partial payment and without needing additional collateral. This update enhances the trading experience by enabling sellers to list gifts at higher prices and receive partial payments, while maintaining a 21-day transfer period. The new system includes provisions for both successful and unsuccessful transactions, ensuring secure and flexible trading. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #7364 · 24.05.2025 г., 20:15

Tonnel Network: Successful Pre-Market Sales #Tonnel#TON Tonnel Network has already surpassed 17,000 TON in its Pre-Market sales. This follows the introduction of a new gift trading mechanism with a 21-day transfer lock. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #7101 · 08.05.2025 г., 10:16

Tonnel Network: Thriving Marketplace Activity #Tonnel#TON Tonnel Network reports significant seller activity on its Gift Marketplace, with 17 users earning over 10,000 TON in sales. Notable sellers include Alex T., Eagle, and Cap, leading in sales volume percentages. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #7099 · 08.05.2025 г., 10:04

Whale Activity on Tonnel Network Gift Marketplace #TON#Tonnel Tonnel Network reports significant whale activity on the Tonnel Gift Marketplace, with 35 users spending over 10,000 TON. Prominent traders include Tyler and Макс Давыдов. Additionally, 25 users hold over 1000 $TONNEL, crucial for Buy Order prioritization. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #7044 · 04.05.2025 г., 20:27

⚡️Tonnel Network Discusses Ethereum Hard Fork and Invoicing Success #Ethereum#Tonnel Tonnel Network shares that over 1300 invoices were processed successfully in just three days using the @send service, highlighting its efficiency. Additionally, there is speculation about a potential Ethereum hard fork if funds were used to buy Lol Pop. Source: link @tonlines

TONlines – News

@tonlines · Post #7233 · 16.05.2025 г., 08:37

⚡️TON — LIVE: Growing Popularity of Telegram NFT Marketplaces #Telegram#Tonnel TON — LIVE reports on the rising popularity of NFT marketplaces offering gifts on Telegram, with Tonnel Marketplace leading the way. Tonnel aggregates gifts from Telegram's official market, contributing to the rapid growth in trading volumes. Source: link @tonlines

TONlines – News

@tonlines · Post #7185 · 13.05.2025 г., 08:53

Tonnel Network: Addressing Gift Duplication Rumors #Telegram#Tonnel Tonnel Network clarifies rumors about a gift duplication bug in Telegram that was allegedly exploited on their marketplace. They assert that this is only a visual bug in their activity logging mechanism, and no gifts or funds are compromised. The statement reassures users that there is no reason for panic. Source: link @tonlines

TONlines – News

@tonlines · Post #7158 · 11.05.2025 г., 10:06

Tonnel Network Achieves Record Trading Volume #Telegram#Tonnel Tonnel Network has set a new record for trading volume in a single day, showcasing the growing success of its Gift Marketplace. This achievement highlights the efficiency of Telegram's reliable APIs. Source: link @tonlines

TONlines – News

@tonlines · Post #7132 · 09.05.2025 г., 10:21

Tonnel Network: Rare Opportunities on Telegram Marketplace #TONNEL#Telegram Tonnel Network suggests users set Automatic Buy Orders on Tonnel Marketplace to seize rare deals listed on Telegram Marketplace from inexperienced traders. Adding $TONNEL to your balance can enhance your chances against competitors like Wizard. Source: link @tonlines

TONlines – News

@tonlines · Post #7127 · 08.05.2025 г., 22:17

Important Update from Tonnel Network on Telegram Marketplace Gifts #Telegram#Tonnel Tonnel Network informs users that gifts purchased through the Telegram marketplace are non-transferable for 21 days. Access to all listed gifts is available via the Tonnel Marketplace, though buying is temporarily restricted until the Telegram API stabilizes. Source: link @tonlines

123•••56
ПретходнаСтраница 1 од 6Следна