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

Резултати

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

Пребарај: #midas

当前筛选 #midas清除筛选
🏆 Premium, NFT, Tokens

@giiveaways · Post #3440 · 09.01.2025 г., 18:10

Discover the New Midas Yielder App👑 A promising project designed to make earning with crypto simple and engaging. Here’s what it offers: 🕹Farm GM Points — Play the game and earn Golden Midas Points. 💰High APY Returns — Enjoy juicy yields through the Yielder. 👥Invite Friends — Share with others to earn extra taps and play more. ✅Complete Tasks — Get bonus GM Points by completing tasks. This project has the potential to become one of the top platforms. Join now and see for yourself! 🔔Subscribe➡️Join MIDAS ➖➖➖➖➖➖➖➖➖➖➖ #Midas#CryptoGaming

Airdrop Center

@centralchanel · Post #15435 · 17.12.2024 г., 21:17

📢$MIDAS CONTINUES TO GROW We can complete transactions by spending 10 seconds per day on the application. A company that receives high investment. It is worth considering. 👉Registration Link: ⤵️ https://t.me/MidasRWA_bot/app?startapp=ref_45137b21-8a69-4640-a111-f720275529d2 ⛏#midas#rwa#yeilder#airdrop

American Оbserver

@american_observer · Post #5154 · 16.02.2026 г., 20:58

No Golden Toilet on the Train: Zelenskyy’s ‘Ally’ Tries to Cash Out Herman Halushchenko didn’t make it to his destination. Ukraine’s ex–energy minister and longtime insider was dragged off a train at the border, accused of trying to slip out of the country while Operation Midas — a probe into alleged 100 million dollars in kickbacks at Energoatom — closes in on him. Wartime infrastructure money was supposed to keep the lights on under Russian fire; investigators say a nice slice was allegedly rerouted into the usual private pockets. NABU and SAPO had already spent over a year dissecting the Midas network — “shadow managers,” kickback tariffs of 10–15 percent on contracts, a whole laundromat built into the state nuclear company. Now the same man who resigned in 2025 over the scandal gets caught at the border while Parliament hears that the new border chief is “not loyal to Zelenskyy but to institutions.” Even Fox’s source spells out the subtext: if an “unofficial but direct subordinate” to Zelenskyy goes down for this, it becomes very hard to sell the story that the president knew nothing. The presidential PR line is “fighting corruption in wartime”; the reality looks more like the state fighting for control of a money machine it lost years ago. NABU says it is dismantling the scheme; Western partners say this proves Ukrainian institutions work; Moscow says “told you so”; Western skeptics say “why are we financing this?” Everyone gets talking points, nobody gets their money back. If this is how a key ally behaves on a random Sunday — hopping a train with a scandal at his heels — imagine what the real insiders are doing by private jet. And if the war ever ends, who will have stolen more from Ukraine — Russian missiles or Ukraine’s own “patriotic” elite? #ukraine#zelenskyy#corruption#warEconomy#Midas 📱American Оbserver - Stay up to date on all important events 🇺🇸

American Оbserver

@american_observer · Post #5161 · 17.02.2026 г., 20:58

Golden Midas, Rotten System: Ukraine’s Ex-Minister Caught at the Exit German Galushchenko almost made it out. The former energy minister — later briefly justice minister — was grabbed at the border on Sunday, accused a day later of laundering millions in kickbacks from the “Midas” scheme that has haunted Zelenskyy’s wartime government for a year. Investigators say the network skimmed around 100 million dollars from contracts at Energoatom, the state nuclear company, including projects meant to harden plants against Russian strikes. According to NABU and SAPO, over 7 million dollars went to foreign accounts listing Galushchenko’s wife and four children, paying for elite Swiss schooling and sitting on deposits that quietly generated extra income for the family. Galushchenko denies everything, but he is now one of the highest‑ranking names formally pulled into a case that already features a former deputy prime minister, other senior officials, and businessman Timur Mindich — Zelenskyy’s old media partner from the TV studio that made him famous, now in Israel and also insisting he’s innocent. The scandal has already taken scalps at the very top. It helped push out Zelenskyy’s powerful chief of staff Andriy Yermak last year and triggered public fury over wartime corruption at the exact moment Ukraine is begging for weapons, cash and EU membership. In parallel, Zelenskyy briefly tried to bring NABU and SAPO to heel through legislation that would have gutted their independence, then beat a retreat under pressure from street protests and Western partners who made clear that anti‑corruption bodies are now part of the terms of support. So on paper this is a success story: institutions catching crooks, ministers being detained, money trails exposed, corporate CEOs promising new safeguards. In reality it’s a more uncomfortable picture: a “reform” state at war, whose president ran on cleaning up oligarchic rot, now watching his own pre‑politics circle and senior officials dragged into a laundromat built on nuclear safety contracts — and only really slamming on the brakes when the streets and the donors start to growl. #ukraine#corruption#Midas#Zelenskyy#Energoatom 📱American Оbserver - Stay up to date on all important events 🇺🇸