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

Резултати

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

Пребарај: #recruitment

当前筛选 #recruitment清除筛选
Audiences Channel

@Audiences_Channel · Post #3 · 14.12.2021 г., 12:44

#Audiences#Notice#Recruitment Audiences官方製作組招募 壓制組要求: 1. CPU為Intel 10代i7或AMD 3700X以上 2. 有一定的時間,學習命令行壓制 3. 進組4部電影為考核,發佈後正式成為組員 4. 有一定的網絡帶寬 5. 非三分鐘熱度,有長久興趣 Web組要求: 人滿了 1. 能準時從流媒體下載並發布 2. 最好有相關平台會員帳號 3. 熟悉各種播放方案 不接受兼職!不接受兼職!不接受兼職! 站內各官組有完善教程,及積分等激勵政策。如有興趣請在站內論壇人員招募貼回帖過發信給管理組。 Channel: @Audiences_Channel

Venture Village Wall 🦄

@venturevillagewall · Post #3532 · 20.12.2024 г., 09:31

Paidly Secures $2M Funding Paidly has raised $2M to enhance its customizable Student Loan Repayment Benefit service, aimed at improving employee recruitment, retention, and financial wellness. Learn more at Paidly. #Paidly#Funding#EmployeeBenefits#Education#FinancialWellness#LoanRepayment#Recruitment#Retention

Venture Village Wall 🦄

@venturevillagewall · Post #4141 · 13.02.2025 г., 13:00

Funding Rounds Announced for Multiple Startups Andesite AI raises $23M for cybersecurity enhancements. Comulate secures $20M for revenue automation in large broker teams. Jolly garners $16.50M, leveraging AI to boost employee performance. ConverzAI obtains $16M to automate staffing with AI agents. ACCURE gathers $16M, transforming battery data into business insights. Legend Labs closes $15M for decentralized finance solutions. ScorePlay raises $13M for AI-powered sports asset management. Swanston Labs and Levee Medical each acquire $10M, focusing on investment ventures and recovery technologies, respectively. Read more about Andesite AI here, Comulate here, Jolly here, ConverzAI here, ACCURE here, Legend Labs here, ScorePlay here, Swanston Labs here, and Levee Medical here. #AI#Cybersecurity#Finance#Automation#DataScience#Sports#Tech#Investments#Sustainability#Recruitment#Decentralized#Media#Production#Innovation#Recovery#VC

Venture Village Wall 🦄

@venturevillagewall · Post #3476 · 19.12.2024 г., 13:57

$500K Funding for Symphony Symphony has successfully raised $500K in funding for its Conversational AI Recruiter, which streamlines the hiring process for customer-facing roles. This funding round took place on December 4, 2024. More details can be found on their website: Symphony. #Funding#AI#Recruitment#ConversationalAI#Tech#Startups#Innovation#CustomerService#Hiring#Automation#Career#JobMarket#Business#Solutions#Entrepreneurship#Growth#Investment#Operations#Talent#Workforce#DigitalTransformation

Zentropa

@zentropa451 · Post #59450 · 29.04.2026 г., 15:29

Le 30 avril 2026, la Légion étrangère célèbre le combat de Camerone. Partout en France 🇫🇷 et en outre-mer, rencontrez les légionnaires lors des journées portes ouvertes exceptionnelles. 👉Retrouvez ci-dessous les dates des J.P.O. des différents régiments: - 1er Régiment Étranger (AUBAGNE) : 30 avril , 1er mai - 2ème Régiment Étranger d'infanterie (NÎMES) : 30 avril ,1er mai et 2 mai -4ème Régiment Étranger (CASTELNAUDARY) : 30 avril , 1er mai - 1er Régiment Étranger de génie (LAUDUN L' ARDOISE): 30 avril , 1er mai -2ème Régiment Étranger de parachutistes (CALVI): 30 avril , 1er mai - 3ème Régiment Étranger d'infanterie(KOUROU):1er mai , 2mai - 5ème Régiment Étranger(DZAOUDZI):1er mai , 2 mai - 2ème Régiment Étranger de génie (SAINT-CHRISTOL): 30 mai , 31 mai * - Groupement de recrutement de la légion étrangère: 30 mai , 31 mai * -13ème Demi-Brigade de la légion étrangère: (LA CAVALERIE-LARZAC): 13 juin , 14juin* Au programme: cérémonie militaire, kermesse, élection miss képi blanc, tombola.... 🟩Nos légionnaires seront heureux de vous accueillir pour répondre à vos questions.🟥 👉Vous trouverez les adresses des régiments sur https://www.legion-recrute.com/fr/regiments. #portesouvertes#sortiesfamilles#weekends#LeSaviezVous#celebration#event#festivites#Camerone#SecondChance#Recrutement#LeSaviezvous#career#recruitment#LatestNews#postoftheday#information#Legionnaires#frencharmy#regarderverslavenir