Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
🇫🇷The presence of 4 thousand French soldiers in the Gaza war
Thomas Bourtes, a member of the #French parliament, announced that more than 4,000 French citizens are participating in the Israeli army in the war against Gaza.
La présence de 4 mille soldats français dans la guerre à Gaza
Thomas Bourtes, député français, a annoncé que plus de 4 000 citoyens français participent à l'armée israélienne dans la guerre contre Gaza.
https://t.me/YediotNewsChat
Еще одна полезная рекомендация для french learners:
https://youtube.com/playlist?list=PLycTNLUo2y2EAKEhVfxB9gYo6r0OTMgM0&si=SBoZIA4aZQhFpzMl
Очень классный подкаст, легко понять и даже есть транскрипт, если слушать на сайте
#french
Я довольно неплохо понимаю текста, которые читаю на французском и после этого фото поняла почему😆
Но я понимаю, что словарный запас надо расширять, поэтому решила, что буду больше читать. С английским было так же, больше всего слов я выучила после фокуса на чтение
#french
#Rap#French
Manau le curé et les Loups
It speaks of a priest guarding a village against a wolf pack, the priest speaks of his regrets and the things he would have liked to do in his life.
In the end, as the sun clears the night, the villagers find the priest dead, killed by the wolves as he was protecting the village.
https://youtu.be/UEpzez_H2CI
After calling the #Hijab “a symbol of women’s submission to men”, #French Interior Minister continues his #Islamophobic comments, calling the Hijab “a sign of inferiority.”
#Op_ed: #Djibouti: Pillar of stability, not a "rentier fortress" in decline
In a rebuttal to an op-ed titled "Crumbling of Rentier Fortress: Ethiopia’s Maritime Pivot, Decline of Djibouti’s Monopoly," Naguib Ali Taher, Communications Officer for the Republic of Djibouti, firmly rejects the characterization of his nation as a “crumbling rentier fortress.” He dismisses the portrayal as both “inaccurate and dismissive,” arguing that it misrepresents the geopolitical reality of the Horn of Africa.
Taher contends that Djibouti remains “an undeniable bedrock of stability” within a volatile region—a status validated by the presence of major #American, #French, #Chinese, and #Japanese military installations.
The author further brushes aside accusations of authoritarianism and regional meddling, labeling them "tabloid-style slander."
https://addisstandard.com/?p=55291
#Vocabee#Snap#amp#Learn#French
Join the Vocabee: Snap & Learn French beta on ✈️#TestFlight
🔗 Link: https://testflight.apple.com/join/tAwWnF8e
Shared by Dimitri