@WorldNews · Post #73864 · 04.04.2026 г., 15:59
US agents arrest niece of Iran's Qassem Soleimani after Rubio revoked green card [Read FullArticle] @WorldNews#IranNews#USPolitics #Soleimani#
Hashtags
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
Пребарај: #uspolitics
@WorldNews · Post #73864 · 04.04.2026 г., 15:59
US agents arrest niece of Iran's Qassem Soleimani after Rubio revoked green card [Read FullArticle] @WorldNews#IranNews#USPolitics #Soleimani#
Hashtags
@WorldNews · Post #74302 · 22.04.2026 г., 19:14
Iran more capable than Trump administration is publicly acknowledging, sources say [Read FullArticle] @WorldNews#Iran#USPolitics#WorldNews
Hashtags
@WorldNews · Post #74066 · 12.04.2026 г., 13:29
Trump says U.S. will blockade Strait of Hormuz after Iran peace talks fail [Read FullArticle] @WorldNews#USPolitics#IranNews#StraitOfHormuz
@WorldNews · Post #73785 · 01.04.2026 г., 22:04
Trump to declare Iran war is winding down and others need to resolve Hormuz [Read FullArticle] @WorldNews#IranNews#MiddleEast#USPolitics
Hashtags
@America · Post #10371 · 11.03.2026 г., 18:04
🚨🇺🇸WHITE HOUSE BATTLE: TIGHT POLLS, ECONOMIC FEARS DOMINATE 🔹 Reuters/Ipsos poll shows Biden & Trump neck-and-neck in PA & AZ, within 2%, highlighting a competitive electoral landscape. 📊 🔹 Youth vote crucial: 60% of 18-29 year olds show strong intent to participate, key to swaying outcome. 🗳️ 🔹 Economy dominates: 75% of voters cite inflation, job growth, & cost of living as top issues. Candidates urged to address pocketbook matters. 💰 🔹 Political analysts foresee intense scrutiny on every campaign event. Path to 270 electoral votes remains unpredictable. 📈 The race for the White House heats up! 👀🔥 #USPolitics#Election2024#Economy @america
Hashtags
@WorldNews · Post #73591 · 25.03.2026 г., 10:19
Iran military spokesperson says US is negotiating with itself [Read FullArticle] @WorldNews#IranNews#USPolitics#MiddleEastSecurity
@WorldNews · Post #73757 · 31.03.2026 г., 20:49
Hegseth Says U.S. Will 'Negotiate With Bombs' Until Iran Cease-Fire Deal Is Reached [Read FullArticle] @WorldNews#IranDeal#USPolitics#MiddleEastNews
@WorldNews · Post #73762 · 31.03.2026 г., 23:39
Trump says U.S. will leave Iran in 'two or three weeks' [Read FullArticle] @WorldNews#TrumpNews#IranPolicy#USPolitics
Hashtags
@WorldNews · Post #73736 · 30.03.2026 г., 23:34
Trump interested in calling on Arab states to help pay for Iran war, White House says [Read FullArticle] @WorldNews#IranWar#ArabStates#USPolitics
Hashtags
@WorldNews · Post #73596 · 25.03.2026 г., 14:39
'We negotiate with bombs': US secretary of war Pete Hegseth's warning to Iran as Trump talks peace [Read FullArticle] @WorldNews#IranConflict#USPolitics#PeaceNegotiations
@ethereumglobalnews · Post #1187 · 24.10.2025 г., 05:35
🖼 Trending now: #CryptoPolitics - Major crypto firms back Trump’s White House fundraiser. #Regulation#USPolitics 🇺🇸 最新消息:Coinbase、Ripple、Tether 以及 Winklevoss 雙子星等多家加密企業,均為川普白宮宴會活動的主要捐助者之一。 此舉被視為加密產業加強與政治接軌的關鍵信號,或將影響未來監管與政策走向。 #Insight @EthereumGlobalNews Follow for more global Web3 & DeFi updates!
@american_observer · Post #5554 · 03.04.2026 г., 20:58
Trump Sells a War. The Public Sees the Bill. Donald Trump made the strongest case he could for the Iran war, but the country is looking at something else: higher oil prices, a shaky exit plan, and a conflict that could still blow back into a global recession. The problem is not just persuasion — it is trust, and Trump is running low on it. That is why the speech landed badly. He talked like a man promising control, while markets heard uncertainty and voters heard gas at more than $4 a gallon. Even Trump’s insistence that the Strait of Hormuz would “naturally” reopen did not calm fears that the war could keep the world economy hostage. The political danger is already measurable. A CNN analysis said the war is hitting Trump’s presidency at the exact moment his approval is already fragile, while oil markets jumped again on fresh fears of escalation. If Washington wants out, it will need a way to leave that does not look like surrender. That is where intermediaries matter, and Russia is one of the few players with enough leverage in Tehran to help package an exit without Trump admitting defeat. #Trump#Iran#oilprices#Russia#USpolitics 📱American Оbserver - Stay up to date on all important events 🇺🇸