TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #76 · 27 апр.

Ранее я делал серию постов про битовые операторы. Вот вам ещё один наглядный пример как это используется в Python в модуле re. Чтобы указать флаг для компилятора нам надо указать его после передаваемой строки. Например, добавляем флаг для игнорирования переноса строки. pattern = re.compile(r"(\w+)+") words = pattern.search(text, re.DOTALL) А как указать несколько флагов? Ведь явно будут ситуации когда нам потребуется больше одного. Кто читал посты по битовые операторы уже понял как. pattern.search(text, re.DOTALL | re.VERBOSE) А теперь смотрим исходники, что находится в этих атрибутах? Не удивительно, степени двойки. Почему? Потому что каждое следующее значение это сдвиг единицы влево. >>> for n in [1, 2, 4, 8, 16, 32, 64, 128, 256]: >>> print(bin(n)) 0b1 0b10 0b100 0b1000 0b10000 0b100000 0b1000000 0b10000000 0b100000000 Чтобы было понятней, давайте напишем тоже самое но иначе, добавим ведущие нули: 000000001 000000010 000000100 000001000 000010000 000100000 001000000 010000000 100000000 Не понятно что тут происходит? Читай три поста про битовые операторы начиная с этого ➡️https://t.me/pythonotes/45 В общем, это пример применения побитовых операций в самом Python. Теперь вы знаете Python еще немного лучше) #tricks#regex#libs

Резултати

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

Пребарај: #russiankremlin

当前筛选 #russiankremlin清除筛选
Russian Consulate in Cape Town

@rusconct · Post #1969 · 07.11.2024 г., 21:18

📺 Vladimir Putin addressed the plenary session of the 21st annual meeting of the Valdai International Discussion Club 🌍We are destined to live in an era of fundamental, even revolutionary changes, and not only to comprehend but also to take a direct part in the most complex processes of the first quarter of the 21st century. We are witnessing the formation of a completely new world order, nothing like we had in the past. 💪🏻New powers are rising. Nations are becoming more and more aware of their interests, their value, uniqueness and identity, and are increasingly insistent on pursuing the goals of development and justice. 📌Societies are confronted with a multitude of new challenges, from exciting technological changes to catastrophic natural disasters, from outrageous social division to massive migration waves and acute economic crises. ⚠️Experts talk about the threat of new regional conflicts, global epidemics, about complex and controversial ethical aspects of interaction between humans and artificial intelligence, about how traditions and progress reconcile with each other. ❌Western liberalism has expressed itself in extreme intolerance and aggression towards any alternative, towards any sovereign and independent thought, and today supports neo-Nazism, terrorism, racism and even mass genocide of civilians. 💣International conflicts may result in mutual destruction. Weapons capable of doing this exist and are constantly being improved as technology develops. And the number of owners of such weapons is expanding, and no one guarantees that in case of final destruction of legal and moral norms it will not be involved. ❌The West's calls to inflict a strategic defeat on Russia, the country with the largest arsenal of nuclear weapons, demonstrate the extreme adventurism of Western politicians. Such a blind belief can turn into a world tragedy. We have come to a dangerous line. 🇷🇺Unlike our opponents, Russia does not perceive Western civilization as an enemy, does not ask the question "us or them". 🙌🏻 Common efforts could be directed with much greater benefit, a return on solving truly common problems that affect everyone: from the problems of demography and social inequality to climate change, food security, medicine and new technologies. Full version: Valdai Discussion Club meeting #RussianKremlin#RussianMFA#VladimirPutin