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

Резултати

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

Пребарај: #aitraining

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

@ai_and_law · Post #569 · 14.05.2025 г., 07:04

🇬🇧UK Artists Demand AI Transparency in Copyright Use More than 400 British artists — including Elton John, Dua Lipa, Coldplay, and Paul McCartney — have signed an open letter urging Prime Minister Keir Starmer to support legislation that would mandate transparency in the use of copyrighted materials for AI training. The letter emphasizes that creative copyright is not just a legal tool but “the lifeblood of the creative industries,” underpinning both moral ownership and economic sustainability for millions. #AI#Copyright#AITraining

AI & Law

@ai_and_law · Post #443 · 14.11.2024 г., 08:04

Copyright Claims on AI Training Dismissed: A Case of Harm and Fair Use A recent New York court decision has set a notable precedent in copyright disputes involving AI training. Judge Colleen McMahon dismissed a lawsuit against OpenAI from news outlets Raw Story and AlterNet, which alleged the unauthorized use of their content to train ChatGPT. The case was dismissed on the grounds that the plaintiffs could not sufficiently demonstrate harm. However, Judge McMahon allowed room for an amended complaint, though she expressed doubt over whether the outlets could establish a recognizable injury under current law. OpenAI maintains that their model training practices align with fair use principles, as they rely on publicly accessible data and established legal precedents. Raw Story and AlterNet are evaluating options for amendment, emphasizing their confidence in addressing the court's concerns. The decision brings to light complex questions on fair use and copyright harm, particularly as AI tools continue to evolve and reshape content creation. #Copyright#AITraining#FairUse#AIRegulation

Crypto M - Crypto News

@CryptoM · Post #65290 · 12.04.2026 г., 14:54

🚀 AI TRENDS | Moore Threads Completes Rapid Adaptation of MTT S5000 GPU for MiniMax M2.7 Moore Threads has announced the successful completion of the Day-0 rapid adaptation of its flagship AI training and inference all-in-one GPU, the MTT S5000, for the new generation large model, MiniMax M2.7. According to Odaily, this achievement further demonstrates the capability of domestically produced full-feature GPUs to quickly respond to and support cutting-edge AI models. #MooreThreads#MTTS5000#AItraining#GPU#MiniMaxM2.7 #AImodels#domesticGPU

EdgeMarket.AI 📣

@edgemarketai · Post #8086 · 31.03.2026 г., 11:54

The next layer of EdgeMarket is live. We’re introducing community validation for real world events feeding verified truth directly into AI systems. Every validation strengthens the network. Every correct signal earns rewards. ⚡ Validate events 🧠. Train AI with real data 💰 Earn $BET This is how decentralised intelligence is built. Signal Truth. Earn $BET Click Here ⬇️ To Start https://edgemarket.ai/bnb/validate-results #EdgeMarket#AI#Web3#Crypto#BET #Airdrop#EarnCrypto#SignalTruth#Validation #Decentralization#AITraining#Blockchain #CommunityDriven#OnChain#DePIN