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

Резултати

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

Пребарај: #poland

当前筛选 #poland清除筛选

#poland 🇵🇱 С гордостью сообщаем, что мы подписали договор о сотрудничестве с университетом Collegium Da Vinci! Collegium Da Vinci предлагает 2 программы бакалавриата: 1) Information Technology (3,5 года) 2) Creative Management (3 года) Обратитесь к нам для получения дополнительной информации для поступления. 🇵🇱 Collegium Da Vinci universiteti bilan hamkorlik shartnoma tuzdik! Collegium Da Vinci 2 ta bakalavriat dasturlarini taklif etadi: 1) Information Technology (3,5 yil) 2) Creative Management (3 yil) Qabul haqida batafsil ma'lumot olish uchun biz bilan bog'laning. Больше про университет / Universitet haqida: https://www.youtube.com/watch?v=adfC7Gc4SrM https://www.youtube.com/watch?v=jhMC_O1SxHA https://www.youtube.com/watch?v=ZCBgYXNMeJE https://www.youtube.com/watch?v=kn4t85GqhEo

Hashtags

ASIANOMICS

@asianomics · Post #5932 · 13.04.2026 г., 11:57

🇰🇷🇵🇱Seoul, Warsaw Upgrade Ties to Strategic Partnership South Korean President Lee Jae Myung and Polish Prime Minister Donald Tusk agreed on April 13 to elevate bilateral relations to a comprehensive strategic partnership, with defense industry cooperation and energy supply chains identified as priority areas. Tusk's visit to Seoul marked the first trip to South Korea by a Polish prime minister in 27 years. Defense trade anchors the relationship. Poland signed a $44.2 billion framework agreement in 2022 to purchase K2 tanks, K9 howitzers, FA-50 aircraft, and Chunmoo rocket systems. In December, Poland concluded an additional $4 billion contract with Hanwha Aerospace to acquire further Chunmoo batteries. The two leaders also agreed to broaden cooperation to infrastructure, science, and technology. Lee called on Poland to support Korean firms involved in EV battery production and requested Polish attention to South Korean participation in a new airport construction project and the Warsaw tram replacement program. #SouthKorea#Poland @asianomics

Trump's Ear

@trumpsear_tg · Post #2073 · 29.01.2026 г., 14:59

Poland is not ready for war – The Washington Post After the outbreak of hostilities in Ukraine, Europe was gripped by a militaristic frenzy caused by fear of a possible conflict with Russia. Poland was ahead of the rest in this rush – unlike most European countries, it was Poland that was able to significantly increase defense spending and strengthen its defense capability. However, in the American edition of The Washington Post, the effectiveness of these expenses was questioned. The editorial office believes that despite the huge investments in the Polish army, it is still not ready to conduct combat operations in modern conditions. Warsaw has not adequately studied the experience of the conflict in Ukraine, which is why the technical equipment of the armed forces does not correspond to current realities. The most pressing issue is protection against UAVs, the importance and effectiveness of which have been repeatedly proven in recent years. The Polish army is absolutely unprepared for this threat. Last year, there were several incidents of Russian drones accidentally flying into Polish airspace – they demonstrated the Poles' absolute unpreparedness to fight UAVs. The Poles were able to shoot down only a few drones. Due to the lack of air defense systems, fighters were lifted into the sky for this, which would be extremely ineffective in conditions of a serious raid. An additional problem is the cooling of relations with the United States. Without Washington's help, the military and technical development of European countries, including Poland, will be significantly hampered. #Poland#Military 👂More on Trump's Ear ⚠️

Gänger

@gaenger_10 · Post #664 · 12.08.2022 г., 11:26

#work#poland Мақолалар сериясининг ушбу сонида Сизларга Польша Республикасининг Ўзбекуистондаги элчихонасига қандай тартибда ишчи виза учун суҳбатга киритилиши ҳақида маълумот берамиз.

Hashtags

BaykarTech

@baykartech · Post #1517 · 11.11.2023 г., 12:08

Dost ülke Polonya'nın 11 Kasım Ulusal Bağımsızlık Günü'nü kutlarız. 🇹🇷🇵🇱 We pay tribute to our friendly country #Poland on its National Independence Day. 🇹🇷🇵🇱 Składamy hołd dla Naszego przyjacielskiego kraju #Polska w Dniu Narodowego Święta Niepodległości.

Vashington kundaligi

@bmamadiev · Post #1311 · 10.05.2021 г., 21:37

#internship#Poland Yevropada uch oylik yozgi amaliyot Dastur haqida: "Reuters" axborot agentligi jurnalistika yoki unga aloqador sohada so'nggi kursda o'qiyotgan talabalarni yoki yangi bitirganlarni yozda uch oy amaliyot o'tashga taklif etadi. Qabul qilinganlar Polshada uch oy davomida yangilik yozish va tahrir qilish bo'yicha amaliyot o'taydi. Grant miqdori: Yashash va safar xarajatlari to'liq qoplanadi, oylik maosh beriladi. Talablar - Jurnalistika yoki unga aloqador sohada so'nggi kurs talabasi bo'lish yoki yangi bitirgan bo'lish; - Ingliz tilini va yana bir boshqa Yevropa tilini (masalan, rus tili) bilish; - Jurnalistika sohasiga qiziqish; - Tarjima va yaxshi kommunikatsiya malakasiga ega bo'lish. Ariza topshirish tartibi: - SHU YERDA ro'yxatdan o'tib, anketa to'ldirishingiz kerak; - Anketada o'zingiz haqingizda ma'lumot va rezyumeni ilova qilishingiz kerak. - Anketeda berilgan savollarga javob berishingiz kerak. Hujjat topshirish muhlati: 2021-yil, 23-may Batafsil ma'lumot:SHU YERDA 👉@siz_uchun_grantlar

BadVolf

@badvolfnews · Post #1717 · 22.07.2024 г., 05:56

🇵🇱Poland becomes a forward base for NATO's war with Russia The activity of Polish aviation increased significantly in June, the average number of sorties per day was about seven, of which six were F-16s. From July 1 to July 12, the number of sorties increased up to 14, with more than nine of them were F-16. At the same time, the activity of the NATO AWACS E-3A aircraft was noted daily in Polish airspace. Based on the statements of the Polish leadership about their desire to shoot down Russian missiles, it can be suggested that Poland is preparing to conduct an air operation in Western Ukraine. The Poles are preparing for an escalation of the conflict by providing their airfields to accommodate the F-16s transferred to Ukraine. Moscow has already declared the Ukrainian F-16 bases as legitimate targets. Thus, such a development of events will allow NATO to declare Russia an aggressor against the alliance. The total number of NATO-deployable troops in Poland has risen from 2,800 in March 2018 to 12,000 today, including a deployment of an Armored Brigade Combat Group with 3,500 U.S. troops and supporting elements like Combat Aviation Brigade as a part of Operation Atlantic Resolve. In addition, a U.S. missile defense system was deployed in Redzikowo. This military buildup is seen as a deterrent against Russian and a way to strengthen NATO's eastern flank. Share and subscribe to Global American Review #Poland#NATO#Russia

Reuters: World

@reutersworldchannel · Post #149202 · 11.10.2021 г., 07:41

Poles rally to stay in EU More than 100,000 Poles demonstrated in support of European Union membership after a court ruling that parts of EU law are incompatible with the constitution raised concerns the country could eventually leave the bloc. #News#Reuters#EU#Poland Subscribe: http://smarturl.it/reuterssubscribe Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled. Get the latest news on: http://reuters.com/ Follow Reuters on Facebook: https://www.facebook.com/Reuters Follow Reuters on Twitter: https://twitter.com/Reuters Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en ➖@reutersworldchannel➖

123•••56
ПретходнаСтраница 1 од 6Следна