TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #22 · 19 јан.

Заметка начинающим, которые часто сталкиваются с подобной непоняткой. Ситуация следующая, есть список файлов: names = [ 'image.bmp', 'second.txt.bkp', 'data.db', '.config.cfg', 'file.ext.bkp' ] И мы хотим убрать у них окончание ".bkp". Не знаю зачем, пример довольно надуманный) Но суть он показывает, а это главное. Те, кто еще не очень знаком с библиотекой os.path или pathlib, вероятно решат обработать имена как строки. И тут вполне подойдет метод строки strip(). Что делает этот метод? Он отрезает указанные символы по обеим сторонам строки. Если ничего не указать, то убирает невидимые символы (пробелы, табуляции и переносы строк). В нашем случае будет выглядеть вот так: >>> name.strip('.bkp') То есть просим удалить строку '.bkp' по краям имени файла, если таковая есть. Можно применить аналогичный метод rstrip(), чтобы отрезать только справа, но для этого примера используем обычный. >>> for name in names: >>> print(name.strip('.bkp')) image.bm second.txt data.d config.cfg file.ext Хм, что-то не то с нашими именами! Что случилось??? Видим нежелательное переименование в именах, где и близко не было указанной строки '.bkp' А дело всё в том, что данный метод ищет не указанную строку, а указанные символы, и не важно в каком порядке. Для метода strip() строка '.bkp' это не паттерн для поискаа список символов. Потому он отрезал симовол 'p' от '.bmp' и удалил точку из файла '.config.cfg'. Как тогда правильно заменить именно паттерн? Для начинающего можно посоветовать метод строки replace(), который как раз использует для замены указанную строку целиком. В нашем примере заменим её на пустую строку. >>> for name in names: >>> print(name.replace('.bkp', '')) image.bmp second.txt data.db .config.cfg file.ext Уже лучше, но помните, это лишь пример про strip(). Для работы с именами файлов есть способы и более "правильные", дающие однозначно верный результат. Я взял файлы только в качестве примера. Даже replase() тут может сделать не то что ожидаем. Просто впредь будьте внимательны с этим strip(). #basic

Hashtags

Резултати

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

Пребарај: #aiintegration

当前筛选 #aiintegration清除筛选

🤖 MCP Protocol: когда AI наконец-то получил доступ к реальному миру Вчера Anthropic выкатили Model Context Protocol для Claude Desktop. И это, похоже, реально меняет правила игры – AI наконец-то может работать с локальными сервисами напрямую. На старте уже доступно 9 базовых инструментов, включая работу с файловой системой, базами данных SQLite, PostgreSQL, и Brave Search. Но самое интересное – протокол открытый, и можно писать собственные интеграции. Прямо сейчас, например, пишу через Cursor модуль для работы с Telegram – хочу дать Claude прямой доступ к чатам 🛠 Например, можно будет сказать "загляни в чат проекта X, принеси последние 50 сообщений" – и он просто сделает это. Никакого ручного копирования или потери контекста. Хотите понять, что происходило в чате за последнюю неделю? Claude проанализирует и составит отчет. Нужно написать большое структурированное сообщение с задачами для команды? Он сформулирует его на основе предыдущих обсуждений 🚀 И главное – всё работает локально, без отправки данных в облака. Claude получает доступ только к тому, что вы явно разрешили. Сейчас активно тестирую возможности и пишу интеграцию с Telegram. Если получится реализовать всё задуманное – это серьезно изменит подход к ежедневной работе с сообщениями и командами 🤔 #AI#MCP#AIIntegration P.S. Кстати, работа с файловой системой уже отлично работает. Claude сам находит и читает нужные документы в разрешенных папках. Очень удобно хранить просто в текстовых документах задачи и файлы контекста, хочу попробовать использовать как замену памяти в ChatGpt. P.S.S Скоро запишу видео как это все подключить себе на маке🤵

Venture Village Wall 🦄

@venturevillagewall · Post #3673 · 23.12.2024 г., 12:57

Solana AI Agents Launched EXMO.me has introduced a new crypto set called Solana AI Agents, which integrates artificial intelligence with Solana's blockchain. Despite ongoing market volatility, the representatives of EXMO.me see this as an opportunity to focus on the technologies of the future. Crypto sets allow users to invest in multiple assets simultaneously. #Solana#AI#Crypto#Blockchain#EXMO#Investment#Volatility#CryptoPortfolio#Technology#Cryptocurrency#MarketGrowth#Innovation#Fintech#AIIntegration#DigitalAssets#Token

Venture Village Wall 🦄

@venturevillagewall · Post #3793 · 05.01.2025 г., 04:00

Onchain Builder + Streamer Prototype Coming Soon Jesse Pollak, head of the Base protocol, predicts a high likelihood of an onchain builder + streamer prototype launching this year. The integration of AI will enable publishing at ten times the speed and facilitate live broadcasting. AI will assist with coding, design, and marketing as well. Read more on X. #AI#Crypto#VC#Base#streaming#onchain#technology#innovation#AIintegration#publishing#livebroadcasting#coding#design#marketing#Prototyping#development#future

Venture Village Wall 🦄

@venturevillagewall · Post #3901 · 17.01.2025 г., 07:00

Transforming the Used Goods Market Investors were initially skeptical of Shopify, yet it grew to 4.5 million stores. A similar transformation awaits the $350 billion used goods market, where 93% of stores are still offline. Innovations using AI can reduce digitalization challenges by 95%. This presents an opportunity for a new platform to revolutionize online reselling. For more insights, check this article: Cointelegraph #Tech#AI#Ecommerce#UsedGoods#Innovation#AIIntegration#MarketGrowth#Digitalization#Reselling#Investment#Shopify#Startup#Entrepreneurship#Revolution#OnlineSelling#Future#Trends#Retail#Fintech#VC

Crypto M - Crypto News

@CryptoM · Post #64594 · 09.04.2026 г., 09:46

🚀 WeChat Pay Launches AI Integration Toolbox for Seamless Payment Solutions WeChat Pay has officially introduced an AI-native integration toolbox designed to offer merchants and developers a streamlined payment integration solution. According to ChainCatcher, this toolbox facilitates the rapid generation of payment function code through natural language commands. The toolbox comprises Skill packages, AI-friendly documentation, and APIs, enabling one-click calls in mainstream AI development environments. Its 'verbal code generation' feature significantly reduces the development process from days to minutes, allowing quick integration of over 20 functions, including mini-program payments, H5 payments, refunds, and profit-sharing. Additionally, the toolbox includes AI diagnostic capabilities that automatically identify code logic issues and provide suggestions for fixes, minimizing financial and system risks during integration. It also supports interface troubleshooting and legacy code upgrades for existing system developers. This upgrade further advances the standardization and AI adaptation of payment capabilities, lowering the digital business barriers for small and medium-sized enterprises. #WeChatPay#AIintegration#PaymentSolutions#Developers#Merchants#AItoolbox#CodeGeneration#DigitalBusiness#SMEs#TechInnovation#PaymentAPI#Automation#SystemUpgrade

Crypto M - Crypto News

@CryptoM · Post #64582 · 09.04.2026 г., 09:15

🚀 AI Event to Showcase Diverse Applications in Pop Culture An event titled 'Super Creator Live - Creating Pop Culture with Prompts' is set to take place this Saturday. According to BlockBeats, the event is co-hosted by Beating and West Sea Voice and will feature ten demo works selected from numerous submissions. Participants include developers with deep technical expertise, influential content creators, and professionals from finance, music, and podcast industries. The diverse backgrounds of the creators promise to offer intriguing perspectives on AI's integration into unexpected fields such as gaming, interactive design, sociology, emotional support, and metaphysics. Following the demo presentations, several prominent guests will engage in a roundtable discussion, focusing on the essence of creation and exploring how to define expression in the era of AI. With only two days left until the event, interested individuals are encouraged to register promptly. The event will take place on April 11 at 13:30 UTC+8, with the location details available upon registration. #AI#PopCulture#Event#Creators#Gaming#InteractiveDesign#Sociology#EmotionalSupport#Metaphysics#AIIntegration#Roundtable#Finance#Music#Podcast#Beating#WestSeaVoice#Demo#AIInCreation#Tech#ContentCreators