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

Резултати

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

Пребарај: #futureofai

当前筛选 #futureofai清除筛选
AI & Law

@ai_and_law · Post #67 · 26.07.2023 г., 07:04

Unveiling the Future of AI: OECD's Expert Group on AI Futures Hello, AI & Law community! The Organisation for Economic Co-operation and Development (OECD) has established a brand new Expert Group on AI Futures to tackle the challenges arising from the rapid advancements in artificial intelligence systems. This initiative aims to provide valuable insights into the future of AI, empowering governments to develop proactive and effective AI policies. The group is intended to provide insights on: 1️⃣ key milestones for possible future developments in advanced AI systems; 2️⃣ various risks associated with each milestone; 3️⃣ best practices in AI safety; 4️⃣ scenarios about AI’s future; and 5️⃣ suggested policy approaches to mitigate future risks while harnessing the benefits of AI. #AI#AIInsights#FutureofAI#AIpolicies#OECD

ChatGPT AI Technology News

@chatgpt_officialnews · Post #234 · 07.08.2025 г., 09:19

🚀Introducing GPT-5: The Next Evolution in AI We’re excited to announce the launch of GPT-5, the latest breakthrough in artificial intelligence technology. This powerful new model brings significant advancements in understanding and generating human-like text, taking AI interactions to a whole new level. 🔍Key Features of GPT-5: Enhanced Language Understanding: GPT-5 can grasp more nuanced contexts, offering even more coherent and contextually aware conversations. Greater Creativity: With improved creativity and imagination, GPT-5 is now capable of generating more dynamic and innovative content, from stories to complex ideas. Faster Processing: Expect lightning-fast responses, with the ability to handle more complex queries at scale. Better Multilingual Support: GPT-5 speaks and understands more languages than ever before, helping you communicate across borders effortlessly. Refined Ethical Safeguards: GPT-5 is designed with enhanced safety mechanisms, making it even better at aligning with human values and ethical standards. 💡 Whether you’re a researcher, developer, content creator, or just curious about the future of AI, GPT-5 is here to empower your work, spark creativity, and unlock new possibilities. 🌐 Dive into the future of AI with GPT-5 today! ➖➖➖➖🔻 🧠 BOT: @Chatgpt_OfficialBOT 💎@Chatgpt_OfficialNews #️⃣#GPT5#AI#ArtificialIntelligence#Innovation#FutureOfAI ➖➖➖➖🔺

ChatGPT AI Technology News

@chatgpt_officialnews · Post #13 · 18.01.2025 г., 14:51

🚀 Exciting News from OpenAI! 🤖✨ OpenAI is reviving its Robotics Initiative, and it's as ambitious as ever! They're hiring for roles to develop versatile, adaptive robots equipped with custom sensors—robots that aim to operate with human-like intelligence in real-world settings. 🌎🤖 Imagine robots navigating our world with the power of OpenAI's cutting-edge AI models—helping, innovating, and making life better for everyone. 🌟 This is a huge step in bringing AI into the physical world, and we can't wait to see what they'll achieve! 🙌 💡 Thoughts on this exciting development? Drop them in the comments below! ⬇️ ➖➖➖➖🔻 💎@Chatgpt_OfficialNewsjoin US ⚡️ 🤖BOT:@Chatgpt_OfficialBOT 📱#ChatGPT#AI#OpenAI#Robotics#AIInnovation#FutureOfAI#TechNews ➖➖➖➖🔺

AI & Law

@ai_and_law · Post #28 · 14.06.2023 г., 13:58

MEPs ready to negotiate first-ever rules for safe and transparent AI Members of the European Parliament (MEPs) are prepared to enter negotiations for the establishment of groundbreaking rules governing the safe and transparent use of artificial intelligence. Today the European Parliament adopted its negotiating position on the Artificial Intelligence Act with 499 votes in favour, 28 against and 93 abstentions ahead of talks with EU member states on the final shape of the law. Negotiations with the Council on the final form of the law will begin later today. #AI#Regulation#EuropeanParliament#AIAct#Ethics#Transparency#DataProtection#Innovation#FutureOfAI

Crypto M - Crypto News

@CryptoM · Post #64466 · 09.04.2026 г., 01:24

🚀 CZ on AI's Trajectory: 'Right Now We Solve Problems for AI — Soon AI Will Solve Problems for Us' Speaking on The Wolf of All Streets Podcast, Binance co-founder Changpeng Zhao (CZ) said the exchange's original 2018 customer service agent "cs_bob" was not true AI but rather an SQL script, which has since evolved significantly. CZ said approximately 80% of Binance's customer support inquiries are now handled from first response to resolution by AI, with a target of reaching 99%. He expressed confidence that advances in neural language models and new training data will close the gap. CZ described AI as one of three transformative technologies of his adult lifetime — alongside the internet and blockchain — and said the trajectory will shift from humans solving problems for AI to AI solving problems for humans. #AI#Binance#CZ#Blockchain#NeuralLanguageModels#CustomerSupport#TechTransformation#FutureOfAI#BNB