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

Пребарај: #privacylaw

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

@ai_and_law · Post #643 · 26.08.2025 г., 07:04

🇺🇸Otter.ai Faces Class Action Over Voice Data and AI Training A lawsuit filed in California alleges that Otter.ai violated the U.S. Electronic Communications Privacy Act, the Computer Fraud and Abuse Act, and multiple California statutes by recording individuals’ voices without consent and using them to train its AI models. The complaint, led by Justin Brewer, emphasizes that while Otter users may accept recordings, non-users—who are not asked for permission—are also captured, raising broader legal and ethical concerns. The case highlights a growing fault line: enterprise transcription and note-taking apps like Otter.ai, Read.ai, and Google Gemini are designed for convenience, yet their silent background operation may expose organizations to litigation. With over 100 potential plaintiffs, this class action underscores a central governance challenge—whether AI tool providers can rely on implied consent in multi-party conversations, or if explicit legal standards will redefine acceptable data practices in enterprise AI. #AIethics#DataProtection#PrivacyLaw#AIGovernance

AI & Law

@ai_and_law · Post #741 · 13.01.2026 г., 08:04

🇭🇰Hong Kong Issues Deepfake Protection Toolkit for Schools Hong Kong’s Office of the Privacy Commissioner for Personal Data (PCPD) has published guidance on the use of an AI deepfake protection toolkit aimed at schools and parents. The guidance explains common types of deepfakes and typical scenarios involving abusive deepfakes in school settings, focusing on risks faced by students. The toolkit provides practical measures for prevention and incident response, outlining the roles of schools, parents, and students. Recommended school-level safeguards include data minimization, restricting access to personal data, and implementing general data security measures to reduce exposure to deepfake misuse. The initiative frames deepfake risks as a data protection and child safety issue, reinforcing the role of privacy governance and preventive controls in educational environments as generative AI tools become more accessible. #AIandLaw#Deepfakes#DataProtection#ChildrenRights#PrivacyLaw#AIRegulation

AI & Law

@ai_and_law · Post #99 · 30.08.2023 г., 07:04

Zoom Addresses EU Privacy Concerns and Updates Terms of Service Greetings! In response to discussions about potential EU privacy law implications, Zoom issues a statement and revises its Terms of Service. The focus? Ensuring customer data isn't utilized to train AI models. Zoom's statement and Terms affirm that user-generated content, including audio, video, chat, and more, isn't employed for training Zoom's or any third-party AI models. This step aims to dispel any concerns. Zoom initially shared its statement on August 7 and later updated it on August 11, aligned with the revised Terms. The shared stance now unequivocally states, "Zoom does not use any of your customer content to train AI models." Earlier, a Stack Diary article flagged changes to Zoom's March Terms, raising potential concerns about broad data utilization for AI model training. Zoom's quick response aims to address these concerns and reaffirm privacy commitments. #Zoom#PrivacyMatters#TermsOfService#AIModels#DataProtection#PrivacyLaw#TechUpdates