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

Резултати

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

Пребарај: #uspto

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

@ai_and_law · Post #523 · 11.03.2025 г., 08:04

🇺🇸USPTO Withdraws AI Strategy Amid Policy Shift The U.S. Patent and Trademark Office (USPTO) has officially withdrawn its AI strategy document, published in January 2025. Acting Director Coke Morgan Stewart cited that the strategy was influenced by Biden-era executive orders, which have since been rescinded by the Trump administration. The new AI policy direction focuses on deregulation and strengthening U.S. global AI dominance—though specific implementation details remain unclear. Key legal questions now come to the forefront: Will the U.S. redefine AI inventorship, potentially allowing corporations to be named as inventors? And how aggressively will the USPTO integrate AI into the patent examination process? These issues could reshape both intellectual property law and AI governance in the years ahead. #AI#PatentLaw#USPTO#AIGovernance#AIRegulation

AI & Law

@ai_and_law · Post #713 · 01.12.2025 г., 08:04

🇺🇸USPTO Reframes AI-Assisted Invention: Human Inventorship Remains the Rule The U.S. Patent and Trademark Office has issued new guidance confirming that AI may support invention but it cannot share or replace inventorship. The USPTO rescinded last year’s AI-specific guidelines and returned to a uniform standard: the same inventorship test applies to all inventions, regardless of whether AI was used in the process. Generative AI is now formally treated as “laboratory equipment” or any other research tool that assists a human creator, not as a co-inventor. Notably, the Office rejected the prior administration’s “joint inventorship”-based framework for determining patentability of AI-assisted inventions. Instead, examiners must ask a single question: did a natural person conceive the invention under traditional doctrine? Courts have already held that AI systems cannot receive patents, but they have not yet ruled on the boundaries of human inventorship when AI is deeply embedded in R&D. This updated guidance will likely shape that future litigation. #AIandLaw#IntellectualProperty#PatentLaw#AIRegulation#USPTO#AIGovernance

AI & Law

@ai_and_law · Post #247 · 23.02.2024 г., 08:04

OpenAI's Trademark Application for 'GPT' Denied Greetings everybody! The US Patent and Trademark Office (PTO) has rejected OpenAI's bid to trademark the term 'GPT' (generative pre-trained transformer), citing its generic nature. According to the PTO, granting the trademark could impede competitors from accurately describing their products as GPT. OpenAI argued that 'GPT' isn't merely descriptive and doesn't immediately convey its meaning to consumers. However, the PTO emphasized that those familiar with the technology understand 'GPT' as a general type of software, not exclusive to OpenAI products. The decision marks a setback for OpenAI, whose association with 'GPT' grew significantly with the popularity of ChatGPT and its subsequent AI models. Despite previous denials, OpenAI may appeal to the Trademark Trial and Appeal Board for another chance to secure the trademark. #OpenAI#GPT#Trademark#USPTO#AI