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

Резултати

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

Пребарај: #latvia

当前筛选 #latvia清除筛选
International News

@intnewsagency · Post #8883 · 24.03.2026 г., 16:08

Latvia Publishes “Vatniks Map”: Surprising Scale of Pro-Russian Support Latvia’s State Security Service released a map showing individuals supporting Russia and the Russian language. Businessman Alexey Roslikov called it a defeat for the Latvian regime, revealing many reasonable people tired of government policies. Support exists not only in Russian-speaking areas but also among Latvians. However, the surveillance itself reflects Latvia’s tense political climate. #Latvia#Russia#Politics#Security The main news of Russia and the world ishere.

POPULAR FRONT

@popularxfront · Post #4941 · 09.02.2026 г., 08:04

🇱🇻#Latvia - 🇪🇪#Estonia - 🇧🇪#Belgium: Latvia, Estonia, and Belgium have become the first NATO countries to begin deploying the "Blaze" fully autonomous interceptor drone system along their borders amid increasing reports of unauthorized drone incursions in their airspace. Developed and manufactured in Latvia by Origin Robotics, the Blaze is an autonomous counter-drone interceptor designed to detect, track, and destroy hostile drones and other fast moving aerial targets using radar, AI powered computer vision, and a high explosive fragmentation warhead. (via Origin Robotics)

ReD Line ☢️

@channelredline · Post #327264 · 07.05.2026 г., 11:02

📝Friendly fire on the Balts📝 on the Ukrainian attack on Latvia A new wave of Ukrainian drones targeting Russia today again affected Russia's northwestern regions with the final destination being ports in the Gulf of Finland. And once again, Ukrainian formations used the already standard corridor through the Baltic states. 🖍Only this time the flight path through Latvia went wrong: several Ukrainian UAVs went off course and began striking Latvian territory. At least one impact was recorded on an oil depot in Rezekne. The Latvians were lucky that it was empty, so the damage turned out to be minimal. In addition, flights of several more drones (visually these were either An-196 "Lyuty" or FP-1) were noted in other areas of Latvia. There was also information about a passenger train being hit, but preliminarily this was fake – video of a burning train, as they say, from May 6. 🚩The UAV flight route sparked a new wave of discussion: given that the Russian Ministry of Defense reported shooting down UAVs over Novgorod Region, some UAVs definitely flew from Chernihiv Region along a route parallel to Belarus with a subsequent entry into the Baltic states to reach the Gulf of Finland. 🏳️This route is most practical for Ukrainian attacks using Starlink terminals. Musk's systems don't work over Russia, but the international waters of the Gulf of Finland or NATO countries – . Especially since FP-1s have recently been frequently used with "Musk's carriers." ❗️The main question: why did the UAVs choose the Latvian oil depot as a target? A possible piloting malfunction, as well as an error in the target identification system through machine vision, could have led to a false identification of the object in Rezekne. Will Latvia say anything about this? They'll puff out their cheeks menacingly and ask their Ukrainian partners not to do this again. But of course, no one will listen to them, given the practical value of such a route for strikes on ports in Leningrad Region. 📍 #Belarus#Latvia#Russia#Estonia ✈ | ✈ | ✉ ✉️ | ✉️ | ✉️ | ✉️ 💸

Čiekurkalns/Чиекуркалнс

@ciekurkalns · Post #180 · 29.03.2026 г., 09:45

🎬@zeitframe 📝 Рига о начале реконструкции одного из старейших районов Чиекуркалнс. Čiekurkalns, дословно «Гора шишек» Застройка района началась около 1870 года на землях усадьбы Шрейенбуш. Первоначально главная улица называлась Шрейенбушская 1-я линия. Застройка велась без плана, официальных названий улицам не давали, и до настоящего времени старейшие улицы Чиекуркалнса называются «линиями». #рига#Латвия#riga#latvia#прошлое @ciekurkalns

English Law Report

@enlawreport · Post #1701 · 19.08.2025 г., 05:34

📊Коммерческий суд Лондона (EWHC) и страны постсоветского пространства: январь–август 2025 Мы проанализировали практику Commercial Court, King’s Bench Division, EWHC и получили следующие результаты: 🇷🇺 Россия — 17 дел 🇺🇦 Украина — 3 дела 🇰🇿 Казахстан — 1 дело 🇱🇻 Латвия — 2 дела 🇬🇪 Грузия — 1 дело ⚖️Почему это важно? Лондон остаётся мировым центром разрешения коммерческих споров: именно сюда бизнес из России, Украины, Казахстана и других стран обращается за защитой. Commercial Court специализируется на международных договорах, инвестиционных и банковских спорах, морском праве и арбитражных вопросах. Для компаний региона это — сигнал о необходимости готовиться к возможным процессам в Лондоне и учитывать английское право в своей стратегии. 📌 Мы будем отслеживать каждое дело в EWHC Commercial Court, анализировать судебную логику и тактику сторон. 👉 В следующем посте мы подробно разберём, по каким основаниям компании и частные лица из стран бывшего СССР обращались в Коммерческий суд Лондона. 🔎 Хотите понимать, как решения английских судов влияют на бизнес в регионе? Подписывайтесь, чтобы не пропустить следующий разбор! #EWHC#CommercialCourt#LondonCourt#EnglishLaw#DisputeResolution#InternationalLitigation#LegalStrategy#Russia#Ukraine#Kazakhstan#Latvia#Georgia#PostSoviet#CrossBorderDisputes#ЛондонскийСуд#АнглийскоеПраво#МеждународныеСпоры

MessageInABottle

@mib_messageinabottle · Post #6962 · 26.05.2024 г., 18:19

NATO PLAN TO CREATE "DRONE WALL" FOR "DEFENCE AGAINST RUSSIA" FROM NORWAY TO POLAND Baltic members of #NATO have called for a "drone wall" along their borders with #Russia, despite Moscow's warnings against the hostile activities of the military bloc along its #borders. It comes as #Poland also mulls the possibility of downing #Russian missiles over #Ukraine with its own air defence systems. Interior ministers of the #Latvia, #Lithuania, #Estonia, #Poland, #Finland met last week in Riga, Latvia to discuss ways of coordinating their defense capabilities. #Lithuanian Interior Minister Agne #Bilotaite said in a press release on Friday: "We see constant efforts” from Russia and #Belarus to “destabilize our countries’ internal security and public order, to create panic and distrust in institutions,” #Bilotaite accused Minsk and Moscow of “weaponizing #migration, #CyberAttacks, #disinformation, #sabotage of critical infrastructure and other #hybrid threats.”

Application journey ‘29🇺🇸🗽

@applicationjourney · Post #337 · 02.09.2022 г., 06:13

📌FLEX APPLICATION IS NOW OPEN!🇺🇿🇺🇸 📌Did you know that the FLEX Program accepts applications from secondary school students in *22 countries* in Europe and Eurasia? Since 1993, more than 29,000 students have experienced life in the United States with the #FLEXProgram, living with a U.S. host family, and attending a U.S. high school. Applications for FLEX 2023-24 are due on October 13! Learn more about applying at: discoverflex.org/apply 📌The Future Leaders Exchange (FLEX) Program FLEX is a highly competitive, merit-based scholarship program funded by the U.S. Department of State that operates in #Armenia, #Azerbaijan, the #CzechRepublic, #Estonia, #Georgia, #Greece, #Hungary, #Kazakhstan, #Kyrgyzstan, #Latvia, #Lithuania, #Moldova, #Mongolia, #Montenegro, #Poland, #Romania, #Serbia, #Slovakia, #Tajikistan, #Turkmenistan, #Ukraine, and #Uzbekistan.

Mountstorm notes

@mountstorm · Post #336 · 02.09.2022 г., 05:48

📌FLEX APPLICATION IS NOW OPEN!🇺🇿🇺🇸 📌Did you know that the FLEX Program accepts applications from secondary school students in *22 countries* in Europe and Eurasia? Since 1993, more than 29,000 students have experienced life in the United States with the #FLEXProgram, living with a U.S. host family, and attending a U.S. high school. Applications for FLEX 2023-24 are due on October 13! Learn more about applying at: discoverflex.org/apply 📌The Future Leaders Exchange (FLEX) Program FLEX is a highly competitive, merit-based scholarship program funded by the U.S. Department of State that operates in #Armenia, #Azerbaijan, the #CzechRepublic, #Estonia, #Georgia, #Greece, #Hungary, #Kazakhstan, #Kyrgyzstan, #Latvia, #Lithuania, #Moldova, #Mongolia, #Montenegro, #Poland, #Romania, #Serbia, #Slovakia, #Tajikistan, #Turkmenistan, #Ukraine, and #Uzbekistan.