Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
Ethiopia’s Ruling Party Central Committee Meeting Ahead of National Election. Read more.
https://borkena.com/2026/02/19/ethiopias-ruling-party-central-committee-meeting-ahead-of-national-election/#Ethiopia#EthiopiaNews#Prosperityparty
Andargachew Tsege says EZEMA dead as a political party for a long time. Read more.
https://borkena.com/2026/03/10/ethiopia-andargachew-tsege-says-ezema-dead-as-a-political-party-for-a-long-time/#AndargachewTsege#EthiopiaNews#EZEMA
Berhanu Nega’s Criticism Of The Opposition Quarter, Reactions To It.
https://borkena.com/2026/03/10/ethiopia-berhanu-negas-criticism-of-the-opposition-quarter-reactions-to-it/#EthiopiaNews#News#EZEMA#BerhanuNega#News
Weekly Recap | Addis Standard
Top stories of the week from Ethiopia and the region.
Watch the full recap.
https://youtu.be/Sm_a10BhwSA?si=1FfftVvZP-wBI7Ny
#Ethiopia#AddisStandard#EthiopiaNews#HornOfAfrica#WeeklyNews
Weekly Recap | Addis Standard
Top stories of the week from Ethiopia and the region. Watch the full recap.
#Ethiopia#AddisStandard#EthiopiaNews#HornOfAfrica#WeeklyNews
https://www.youtube.com/watch?v=OlJTzSXAltc
From regional diplomacy to public health updates—here’s what shaped the week in East Africa.
👉 Addis Standard Weekly News Recap covers:
• Red Sea security talks involving Eritrea and Sudan
• Ethiopia’s latest Marburg update
• Major changes in Ethiopia’s media leadership
• U.S.–Somalia aid suspension
• Visa denials affecting Ethiopian athletes
• And more regional & global developments
▶️ Watch, share, and stay informed with Addis Standard.
https://www.youtube.com/watch?v=7n-nq-Dg1Ow
#WeeklyRecap#EthiopiaNews#HornOfAfrica#AddisStandard#AfricanNews
#Premiering_now: The Standard Signal | Ep.15: Ethiopia Under Pressure: Fuel Crisis, Global & Regional Instability, a Fragile Election | Jawar Mohammed
Click here to watch: https://www.youtube.com/watch?v=HexAbPk8Dkw
Ethiopia is facing mounting pressures. In Episode 15 of The Standard Signal, host Tsedale Lamma brings Jawar Mohammed to discuss the deepening fuel shortage and corruption concerns in Ethiopia, the looming fertilizer crisis and its implications for food security, and the impact of Middle East war on Ethiopia’s economy and stability.
#AddisStandard#TheStandardSignal#Ethiopia#JawarMohammed#EthiopiaPolitics#Corruption#FuelCrisis#HornOfAfrica#Tigray#Amhara#Oromia#EthiopiaElection#AfricaPolitics#EthiopiaNews#AfricanPolitics#Geopolitics
#Coming_UP: The Standard Signal | Ep.15: Ethiopia Under Pressure: Fuel Crisis, Global & Regional Instability, a Fragile Election | Jawar Mohammed
#TsedaleLemma speaks with #JawarMohammed about the growing challenges facing Ethiopia, from global and regional tensions to domestic instability, corruption and Ethiopia’s fragile election.
Premiers at: 7:30 PM EAT tonight.
Subscribe to watch: https://www.youtube.com/@AddisStandard
#AddisStandard#TheStandardSignal#Ethiopia#JawarMohammed#EthiopiaPolitics#Corruption#FuelCrisis#HornOfAfrica#Tigray#Amhara#Oromia#EthiopiaElection#AfricaPolitics#EthiopiaNews#AfricanPolitics#Geopolitics