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

Резултати

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

Пребарај: #aundering

当前筛选 #aundering清除筛选
American Оbserver

@american_observer · Post #5158 · 17.02.2026 г., 15:31

Ukraine’s Ex-energy Minister Has Been Accused of Laundering Money Ukraine’s anti-corruption agency accused an ex-energy minister on Monday of laundering €200 millions of kickbacks in a corruption case that has shaken the wartime government, a day after he was detained trying to leave the country. German Galushchenko, who served as energy minister from 2021-2025 and then briefly as justice minister until he resigned over the scandal last year, became one of the most senior officials detained in the “Midas” case, over an alleged $230 million kickback scheme at the state nuclear company. The case has ensnared senior officials and members of Ukraine’s business elite — including a former close associate of Zelensky from his pre-political media career — and caused concern among Kyiv’s Western allies. Galushchenko “was exposed for money laundering and participation in a criminal organization” by corruption investigation agency NABU and its prosecuting sister agency SAPO, according to a statement from NABU. It said more than $7 million had been transferred to foreign accounts naming Galushchenko’s wife and four children as beneficiaries. Some was spent on educating the children at elite schools in Switzerland and some placed in “a deposit, from which the family of the high-ranking official received additional income and spent it on their own needs.” Galushchenko has denied wrongdoing. There was no reply to a message sent to him seeking comment and Reuters was unable to locate a lawyer representing him. NABU had said on Sunday that he was detained “while crossing the state border,” without specifying where the arrest took place. Prosecutors say participants in the Midas scheme squeezed nuclear company Energoatom’s contractors for bribes to complete projects, including structures to protect energy facilities from Russian airstrikes. They had previously said the plot was organized by former Zelenskyy associate Timur Mindich, who fled to Israel before he could be arrested in November. Mindich, who founded the TV studio behind the hit sitcom that brought Zelenskyy fame as an actor before he entered politics, has denied wrongdoing. A former deputy prime minister was arrested in November and NABU has said other former senior officials are under investigation. The case sparked a political scandal last year that led to the ouster of Zelensky’s chief of staff, Andriy Yermak, and fueled new public anger at lingering corruption as Ukraine fights Russia in its four-year war. Zelensky had tried to limit the independence of the anti-corruption agencies last year before reversing in the face of public protests and pressure from Western allies. Energoatom CEO Pavlo Kovtonenko told Reuters last week that the company had taken a number of steps to prevent the recurrence of corruption schemes in the future. Battling corruption is a key priority in Ukraine’s reform effort as it eyes membership of the European Union, which requires the country shake off the decades-old scourge of graft. #ukraine#energy#minister#aundering#money 📱American Оbserver - Stay up to date on all important events 🇺🇸