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

Резултати

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

Пребарај: #russiaasean

当前筛选 #russiaasean清除筛选
Embassy of Russia in Singapore

@rusembsg · Post #4200 · 28.08.2025 г., 16:07

🗓 On August 28, 2025 the 7th ASEAN-Russia Senior Officials Meeting on Drug Matters (ASOD) was held in Singapore. The Russian delegation headed by Dmitry Subbotin, Deputy Director of the Department on New Challenges and Threats of the Russian Ministry of Foreign Affairs, comprised of the representatives of the Ministry of Internal Affairs of Russia, the Ministry of Health of Russia, Rosfinmonitoring and the Federal Customs Service. The participants exchanged views on the current trends in illicit drug production and trafficking in the region and around the world. The discussion was focused on the best practices in combating the drug-related crime, the laundering of the drug proceeds as well as drug use prevention and treatment. The main areas of technical assistance for ASEAN Member States have been outlined. 🤝 Following the meeting, a five-year ASEAN-Russia counter-narcotics work plan was endorsed. The plan is aimed at implementing the statement of the Leaders of our countries on cooperation in combating drug trafficking, which was approved during the ASEAN-Russia Summit in October 2021. #RussiaASEAN

Hashtags

Embassy of Russia in Singapore

@rusembsg · Post #4149 · 11.07.2025 г., 06:48

🎙Foreign Minister Sergey Lavrov’s remarks at #RussiaASEAN Ministerial Meeting(Kuala Lumpur, July 10, 2025) 💬 It is a genuine pleasure to join you all here in Kuala Lumpur today. First, I would like to thank Malaysia for the hospitality and the excellent organisation of today’s event, and express gratitude to Myanmar, as the coordinator of the Russia-ASEAN dialogue, for its efforts in advancing our strategic partnership. This year marks the 80th anniversary of Victory in World War II. The defeat of Nazi Germany and militarist Japan, to which our country made a decisive contribution, created the conditions for the decolonisation process in Asia and elsewhere, and the subsequent formation of a modern security and cooperation architecture in the Asia-Pacific region. The association lies at its core. 🤝 The first Russia-ASEAN summit was held right here in Malaysia’s capital 20 years ago. It not only elevatedourdialogue to a whole new level, but also cemented its comprehensive nature, as reflected in the Declaration adopted at the leaders’ meeting. Then, in 2018, our partnership was officially granted strategic status. Today, it is safe to say that ASEAN is truly Russia’s reliable friend and like-minded partner. We are united by our commitment to broad-based and equitable international cooperation based on the UN Charter and the full set of interconnected principles that are laid out in the Charter. For our part, we consistently support the centrality of ten ASEAN countries in regional affairs. 🌐 Next year will mark the 35th anniversary of Russia-ASEAN relations, which, as I just mentioned, have gained fundamentally new depth over the years. Russia-ASEAN partnership strongly contributes to stability in the Asia-Pacific region. Cooperation in politics, security, and countering new challenges and threats continues to make strides. The economy, energy, agriculture, and humanitarian ties are marked by positive dynamics. We believe today’s meeting will help unlock further potential in our dialogue, expand its sectoral agenda, and launch new joint mechanisms especially in science-intensive and high-tech sectors. ✍️ The adoption of a new Russia-ASEAN policy paper for 2026-2030 is intended to advance these objectives. This document will outline current goals and priority cooperation areas. We look forward to a constructive outcome from today’s discussions.

Hashtags

Russian Consulate in Cape Town

@rusconct · Post #2824 · 11.07.2025 г., 06:12

🎙Foreign Minister Sergey Lavrov’s remarks at #RussiaASEAN Ministerial Meeting(Kuala Lumpur, July 10, 2025) 💬 It is a genuine pleasure to join you all here in Kuala Lumpur today. First, I would like to thank Malaysia for the hospitality and the excellent organisation of today’s event, and express gratitude to Myanmar, as the coordinator of the Russia-ASEAN dialogue, for its efforts in advancing our strategic partnership. This year marks the 80th anniversary of Victory in World War II. The defeat of Nazi Germany and militarist Japan, to which our country made a decisive contribution, created the conditions for the decolonisation process in Asia and elsewhere, and the subsequent formation of a modern security and cooperation architecture in the Asia-Pacific region. The association lies at its core. 🤝 The first Russia-ASEAN summit was held right here in Malaysia’s capital 20 years ago. It not only elevatedourdialogue to a whole new level, but also cemented its comprehensive nature, as reflected in the Declaration adopted at the leaders’ meeting. Then, in 2018, our partnership was officially granted strategic status. Today, it is safe to say that ASEAN is truly Russia’s reliable friend and like-minded partner. We are united by our commitment to broad-based and equitable international cooperation based on the UN Charter and the full set of interconnected principles that are laid out in the Charter. For our part, we consistently support the centrality of ten ASEAN countries in regional affairs. 🌐 Next year will mark the 35th anniversary of Russia-ASEAN relations, which, as I just mentioned, have gained fundamentally new depth over the years. Russia-ASEAN partnership strongly contributes to stability in the Asia-Pacific region. Cooperation in politics, security, and countering new challenges and threats continues to make strides. The economy, energy, agriculture, and humanitarian ties are marked by positive dynamics. We believe today’s meeting will help unlock further potential in our dialogue, expand its sectoral agenda, and launch new joint mechanisms especially in science-intensive and high-tech sectors. ✍️ The adoption of a new Russia-ASEAN policy paper for 2026-2030 is intended to advance these objectives. This document will outline current goals and priority cooperation areas. We look forward to a constructive outcome from today’s discussions.

Hashtags

Russian Mission to ASEAN

@aseanrussia · Post #1825 · 29.08.2025 г., 10:53

🗓 On August 28, 2025 the 7th ASEAN-Russia Senior Officials Meeting on Drug Matters (ASOD) was held in Singapore. The Russian delegation headed by Dmitry Subbotin, Deputy Director of the Department on New Challenges and Threats of the Russian Ministry of Foreign Affairs, comprised of the representatives of the Ministry of Internal Affairs of Russia, the Ministry of Health of Russia, Rosfinmonitoring and the Federal Customs Service. The participants exchanged views on the current trends in illicit drug production and trafficking in the region and around the world. The discussion was focused on the best practices in combating the drug-related crime, the laundering of the drug proceeds as well as drug use prevention and treatment. The main areas of technical assistance for ASEAN Member States have been outlined. 🤝 Following the meeting, a five-year ASEAN-Russia counter-narcotics work plan was endorsed. The plan is aimed at implementing the statement of the Leaders of our countries on cooperation in combating drug trafficking, which was approved during the ASEAN-Russia Summit in October 2021. #RussiaASEAN

Hashtags

Russian Mission to ASEAN

@aseanrussia · Post #1761 · 10.07.2025 г., 11:13

🎙Foreign Minister Sergey Lavrov’s remarks at #RussiaASEAN Ministerial Meeting(Kuala Lumpur, July 10, 2025) 💬 It is a genuine pleasure to join you all here in Kuala Lumpur today. First, I would like to thank Malaysia for the hospitality and the excellent organisation of today’s event, and express gratitude to Myanmar, as the coordinator of the Russia-ASEAN dialogue, for its efforts in advancing our strategic partnership. This year marks the 80th anniversary of Victory in World War II. The defeat of Nazi Germany and militarist Japan, to which our country made a decisive contribution, created the conditions for the decolonisation process in Asia and elsewhere, and the subsequent formation of a modern security and cooperation architecture in the Asia-Pacific region. The association lies at its core. 🤝 The first Russia-ASEAN summit was held right here in Malaysia’s capital 20 years ago. It not only elevatedourdialogue to a whole new level, but also cemented its comprehensive nature, as reflected in the Declaration adopted at the leaders’ meeting. Then, in 2018, our partnership was officially granted strategic status. Today, it is safe to say that ASEAN is truly Russia’s reliable friend and like-minded partner. We are united by our commitment to broad-based and equitable international cooperation based on the UN Charter and the full set of interconnected principles that are laid out in the Charter. For our part, we consistently support the centrality of ten ASEAN countries in regional affairs. 🌐 Next year will mark the 35th anniversary of Russia-ASEAN relations, which, as I just mentioned, have gained fundamentally new depth over the years. Russia-ASEAN partnership strongly contributes to stability in the Asia-Pacific region. Cooperation in politics, security, and countering new challenges and threats continues to make strides. The economy, energy, agriculture, and humanitarian ties are marked by positive dynamics. We believe today’s meeting will help unlock further potential in our dialogue, expand its sectoral agenda, and launch new joint mechanisms especially in science-intensive and high-tech sectors. ✍️ The adoption of a new Russia-ASEAN policy paper for 2026-2030 is intended to advance these objectives. This document will outline current goals and priority cooperation areas. We look forward to a constructive outcome from today’s discussions.

Hashtags

Russian Mission to ASEAN

@aseanrussia · Post #1744 · 10.07.2025 г., 03:31

🛬 Russia's Foreign Minister Sergey Lavrov arrives in Kuala Lumpur (Malaysia) to participate in the Foreign Ministers' meetings of #RussiaASEAN, East Asia Summit and ASEAN Regional Forum.

Hashtags

Russian Mission to ASEAN

@aseanrussia · Post #840 · 10.02.2024 г., 04:05

🎥 Ambassador Evgeny Zagaynov’s video greetings on Diplomatic Worker’s Day. 📚 Brief history of Russian diplomatic service 🇷🇺🌏 As well as retrospect of #RussiaASEAN relations

Hashtags

Russian Mission to ASEAN

@aseanrussia · Post #175 · 05.12.2022 г., 05:29

⭐️ Precious memorable moments of our ASEAN friends participating in the complex training “The use of Modern Molecular Genetic Technologies in Ensuring Biological Safety” in Vladivostok, Russia 🇷🇺. 🙏 🎓 1-year project, held under the auspices ASEAN-Russia Dialogue Partnership, was aimed at increasing the ASEAN countries capacity for early detection and diagnosis of infectious diseases by improving the skills of specialists in the field of epidemiology, virology and bacteriology. #RussiaASEAN

Hashtags

Russian Mission to ASEAN

@aseanrussia · Post #168 · 02.12.2022 г., 07:18

✍️ More than 50 experts from ASEAN Member States took part in a number of trainings and seminars organised by the Central Research Institute of Epidemiology of Rospotrebnadzor (Russian Federal Service for the Oversight of Consumer Protection and Welfare) in Vladivostok 🇷🇺. 1-year project on “The Use of Modern Molecular Genetic Technologies in Ensuring Biological Safety” was held under the auspices ASEAN-Russia Dialogue Partnership and was aimed at increasing the ASEAN countries capacity for early detection and diagnosis of infectious diseases by improving the skills of specialists in the field of epidemiology, virology and bacteriology. #RussiaASEAN

Hashtags

Russian Mission to ASEAN

@aseanrussia · Post #149 · 08.08.2022 г., 14:23

🎙 FM Sergey Lavrov’s remarks at the #RussiaASEAN Post Ministerial Conference 💬 I am pleased to state that despite the current international turbulence, we are expanding the range of our dialogue, enhancing the level of our industry-specific platforms, and deepening trade, economic and humanitarian ties. I would like to mention separately the implementation of the joint initiatives in science and technology during the current Russia-ASEAN Year of Scientific and Technical Cooperation. We believe that our entire system of cooperation, including our multilateral and bilateral ties, objectively facilitates the consolidation of the regional architecture for security and sustainable development. 🇷🇺 Russia consistently supports many integration platforms and projects and the pooling of their efforts to promote a unifying, future-oriented agenda.

Hashtags

123•••10•••1213
ПретходнаСтраница 1 од 13Следна