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

Резултати

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

Пребарај: #databreach

当前筛选 #databreach清除筛选
Venture Village Wall 🦄

@venturevillagewall · Post #4166 · 16.02.2025 г., 13:00

Nippon Steel Hit by Ransomware Attack 💻 Nippon Steel faces serious breach from BianLian, stealing 500GB of sensitive data. The attackers disclosed private info including financial data and personal details of top executives. With over 113,000 employees and $57.5B annual revenue, Nippon Steel is a key player in the steel industry worldwide. The hack adds to the company's challenges in 2025. 📌 For more details, visit Financial Times. #NipponSteel#BianLian#CyberSecurity#DataBreach#Ransomware#SteelIndustry#Japan#TechNews

Crypto M - Crypto News

@CryptoM · Post #65151 · 11.04.2026 г., 13:05

🚀 Lakeview Loan Servicing Reaches $26 Million Settlement Over Data Breach Lakeview Loan Servicing has agreed to a proposed $26 million settlement following a data breach that impacted 2.53 million individuals in the United States. According to NS3.AI, the lawsuit alleges that unauthorized actors gained access to the company's systems, potentially exposing names, Social Security numbers, financial account details, and other personal information. While Lakeview denies any wrongdoing, eligible class members may receive compensation, credit monitoring, and identity protection if the settlement is approved. #DataBreach#Settlement#Privacy#IdentityProtection#FinancialServices#CyberSecurity#USNews

Crypto M - Crypto News

@CryptoM · Post #64880 · 10.04.2026 г., 06:24

🚀 Security Concerns Arise Over LLM Agent API Routers On April 10, Solayer founder @Fried_rice highlighted on social media the growing reliance of large language model (LLM) agents on third-party API routers, which distribute tool call requests to multiple upstream providers. According to BlockBeats, these routers operate as application layer proxies and can access each JSON payload in plaintext during transmission. However, no provider currently enforces encryption integrity protection between the client and upstream models. A study tested 28 paid routers purchased from platforms like Taobao, Xianyu, and Shopify independent sites, along with 400 free routers collected from public communities. The findings revealed that one paid router and eight free routers were actively injecting malicious code. Additionally, two routers deployed adaptive evasion triggers, 17 accessed AWS Canary credentials owned by researchers, and one stole ETH from a private key held by researchers. Further poisoning studies demonstrated that seemingly harmless routers could also be exploited. A leaked OpenAI key was used to generate 100 million GPT-5.4 tokens and over seven Codex sessions. Weaker bait configurations resulted in 2 billion billing tokens, 99 credentials across 440 Codex sessions, and 401 sessions running autonomously in YOLO mode. The research team developed an experimental proxy named Mine, capable of executing all four types of attacks on four public proxy frameworks. They also verified three client defense strategies: fault lock strategy gating, response-side anomaly screening, and append-only transparent logging. #LLM#API#Security#CyberSecurity#Malware#DataBreach#Encryption#Proxy#AI#MachineLearning#ETH

Crypto M - Crypto News

@CryptoM · Post #65165 · 11.04.2026 г., 14:20

🚀 Heart South Reports Potential Data Breach Affecting Thousands Heart South has announced that approximately 46,666 individuals may have been affected by a data breach, with patient information from its network appearing on the dark web. According to NS3.AI, the company has been unable to verify if any specific individual's data was compromised. Notifications regarding the potential breach began being distributed in April 2026. #HeartSouth#databreach#patientdata#darkweb#NS3AI#privacy#cybersecurity#datasecurity#breachnotification#April2026