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 слични објави

Пребарај: #gpai

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

@ai_and_law · Post #622 · 28.07.2025 г., 07:04

🇪🇺EU Mandates Transparency on AI Training Data for GPAI The EU has released its official template for the mandatory training data summary required under Article 53(1)(d) of the EU AI Act. Starting August 2, providers of general-purpose AI models must publicly disclose a sufficiently detailed overview of the content used for model training. This includes naming major datasets, public or private, and offering narrative context for other sources, as clarified in Recital 107. This is a structural shift in regulatory expectations. AI developers can no longer obscure data provenance or sidestep questions of copyright and data protection. The summary isn’t just a compliance formality, it’s a mechanism for enforcement. Rights holders and regulators finally gain a clear window into the inputs behind powerful AI systems. #GPAI#EUAIAct

AI & Law

@ai_and_law · Post #457 · 04.12.2024 г., 08:04

Decoding the AI Act: Q&A on General-Purpose AI The AI Office has released a detailed Q&A to clarify critical aspects of the AI Act, focusing on general-purpose AI (GPAI). While emphasizing that only EU Courts can provide definitive interpretations, the document addresses GPAI risks, provider obligations, and compliance requirements. It also sheds light on the role of the General-Purpose AI Code of Practice, including its legal implications, limitations, and specific provisions for startups. Key insights include requirements for open-source models, R&D exemptions, and obligations tied to model fine-tuning. The document outlines enforcement mechanisms and a timeline for finalizing the Code of Practice, stressing its importance as a guide rather than a binding regulation. This Q&A provides essential context for stakeholders navigating the evolving AI regulatory landscape. #AIRegulation#GPAI#AIEthics#AIAct

AI & Law

@ai_and_law · Post #605 · 02.07.2025 г., 07:04

🇪🇺AI Rules Must Serve People, Not Just Platforms: Open Letter to the European Commission A powerful coalition including Nobel laureates Daron Acemoglu and Geoffrey Hinton has called on the European Commission to stay the course on general-purpose AI (GPAI) regulation. In a joint letter to President von der Leyen, researchers, civil society leaders, and industry experts urge EU leaders not to weaken GPAI rules under pressure from tech lobbies. Their message: innovation and rights protection are not mutually exclusive. The signatories back the Code of Practice developed over the past nine months as a pragmatic governance tool — one that applies only to 5–15 major players and mirrors existing risk management norms. They recommend mandatory third-party testing for systemic-risk models, agile review mechanisms, and significant resourcing of the AI Office, including 300 dedicated personnel and top-tier safety expertise. #AIRegulation#GPAI#AIEthics#EUAIAct

AI & Law

@ai_and_law · Post #813 · 24.04.2026 г., 07:04

🇪🇺First Scholarly Commentary Focuses on EU GPAI Rules The Leverhulme Centre for the Future of Intelligence at the University of Cambridge and the Institute for Law & AI have launched the first academic commentary dedicated exclusively to the general-purpose AI (GPAI) model provisions of the EU AI Act. The project addresses regulatory uncertainty surrounding GPAI systems, particularly models that may present systemic risk. Rather than promoting a single interpretation, the commentary analyzes each provision by outlining where the law is clear, where ambiguity remains, and the strongest legal arguments on competing sides. The initiative launches with Chapter V of the AI Act, with additional articles to be released on a rolling basis. #AIRegulation#EUAIAct#GPAI#LegalResearch#AIGovernance

इस हफ्ते का #FridaysAtMyGov लाइव हो चुका है।। 🥳 आइए इस लेटेस्ट एपिसोड में #GPAI शिखर सम्मेलन में नए भारत की एआई के क्षेत्र में बढ़ती ताकत को जानें। अभी देखें पूरा एपिसोड: https://youtu.be/ABfmjdKoz2c?feature=shared #NewIndia#MyGov #GPAISummit

AI & Law

@ai_and_law · Post #617 · 18.07.2025 г., 07:04

🇪🇺 EU AI Act: Voluntary Code, Strategic Signal The EU AI Office is now officially inviting general-purpose AI model providers to sign the General-Purpose AI Code of Practice. Signing is voluntary — but strategic. Companies like OpenAI and Mistral have already committed, signaling alignment with the EU’s emerging regulatory expectations. Signatories gain more than reputational capital: the EU Commission will prioritize monitoring adherence to the code rather than imposing full administrative scrutiny. This approach offers regulatory predictability and reduced compliance burden — a clear incentive ahead of the AI Act’s enforcement starting 2 August 2025. The list of signatories will be published on 1 August 2025. #AIRegulation#EUAIAct#GPAI#AIEthics # #OpenAI#Mistral