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

Резултати

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

Пребарај: #audiobook

当前筛选 #audiobook清除筛选
MILLIONER KUTUBXONASI

@Biglibrary_uz · Post #9172 · 16.08.2025 г., 08:44

🛜🔠🔠🔠🔠🔠 🔠🔠🔠🔠 💛 Alkimyogar Bu kitobni qancha kop maqtasam arziydi! Qayta qayta tinglang Va o'qing! Va albatta barcha ORZU maqsadlaringiz Amalga oshganda bizni ham albatta tabassum bilan eslab qo'ying 🤍 🤍 SİZ SO'RAGAN AUDİO KİTOB! #audiobook 💛@Biglibrary_uz

Hashtags

MILLIONER KUTUBXONASI

@Biglibrary_uz · Post #8849 · 26.03.2025 г., 06:55

🔠🔠🔠🔠🔠🔠🔠🔠 🎙 Ichindagi ichindadur 💡 Hayrlı kun kitobsevar qadrdonlarim!! Sizga Juda zo'r #audiobook🎧 bilan keldim. Albatta tinglang! Juda ham zo'r kitob! Qancha tariflasam , shuncha so'zlar ojizlik qiladi! Ming marta maqtagandan ko'ra bir marta o'zingiz mazasini tatib koring 🫂 Bu kitobni o'qiganlar Yoki tinglaganlar bormi , 🔥 reaksiyalarni bosib qoying @Milliarderlarim

Hashtags

PT资讯频道

@PrivateTrackerNews · Post #799 · 12.08.2019 г., 14:30

2019/08/12 #开放注册 #OpenSignupTracker #国外PT 电报 @PT资讯频道 Telegram @privatetrackernews 电子书/有声书/在线学习 Tracker's Name: #Audiobook (ABT) Genre: ELearning Sign-up Link: https://abtorrents.me/signup.php Closing Date: 12/8/2019 till 18/8/2019. Additional information: Audiobook Torrents is a Private Torrent Tracker for ELearning releases.

Velvet Pages | eLibrary 🥂

@bookslibraryofficial · Post #1534 · 09.03.2026 г., 16:01

📖Title : The Frozen River ✍️Author : Ariel Lawhon ⭐️Rating : 4.38/5 (Goodreads) 📆Published : Dec 05, 2023 ———————————————— Summary:The Frozen River by Ariel Lawhon is a historical mystery set in 1789 Maine. Midwife and healer Martha Ballard is called to examine the body of a man found trapped in the frozen Kennebec River. While authorities quickly declare the death an accident, Martha suspects something far darker. As she records events in her diary and follows the clues, she uncovers a web of violence, secrets, and injustice involving powerful members of the community. Determined to seek the truth despite threats and social pressures, Martha risks her reputation and safety while fighting for justice in a society where women’s voices are often ignored. ———————————————— #fiction#mystery#audiobook#historical#thriller#ariellawhon#thefrozenriver@Bookslibraryofficial

Velvet Pages | eLibrary 🥂

@bookslibraryofficial · Post #1514 · 07.01.2026 г., 15:34

📖Title : More Days at the Morisaki Bookshop ✍️Author : Satoshi Yagisawa ⭐️Rating : 3.85/5 (Goodreads) 📆Published : Dec 06, 2011 ———————————————— Summary:More Days at the Morisaki Bookshop follows Takako as she continues healing while living above her uncle’s secondhand bookshop in Tokyo’s Jimbocho district. Surrounded by books and familiar faces, she confronts lingering grief, evolving relationships, and quiet uncertainties about the future. The novel focuses on small, meaningful moments, showing how literature, routine, and human connection gently restore a sense of belonging. Through everyday interactions, it portrays healing as gradual, imperfect, and deeply tied to community, memory, and the comforting presence of books. ———————————————— #fiction#japan#cozy#audiobook#romance#moredaysatthemorisakibookshop#satoshiyagisawa@Bookslibraryofficial@free_novellas@eternalmantra

Velvet Pages | eLibrary 🥂

@bookslibraryofficial · Post #1499 · 30.12.2025 г., 15:06

📖Title : Bemused ✍️Author : Farrah Rochon ⭐️Rating : 3.92/5 (Goodreads) 📆Published : Jan 07, 2025 ———————————————— Summary:Five sheltered sisters living in a quiet seaside village learn that they are the legendary Muses, daughters of Mnemosyne, Goddess of Memory. After their mother is kidnapped by Hades, the sisters are forced to leave their protected lives behind. Guided by Calliope’s leadership, they journey through dangerous lands, face mythical trials, and uncover their divine powers. Along the way, they confront fear, doubt, and destiny itself. Through music, storytelling, courage, and unity, the sisters strengthen their bond and transform from overlooked performers into heroic figures, embracing their true identities and shaping their own legendary “gospel truth.” ———————————————— #fantasy#mythology#retellings#fiction#historicalfiction#audiobook#bemused#farrahrochen@Bookslibraryofficial@free_novellas@eternalmantra

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