Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
#photo#SouthSudan
The world’s newest country, South Sudan, marked a decade of independence this month, but it’s still one of the world’s poorest nations, scarred by war and hunger.
South Sudan gained independence in 2011, but an intertribal conflict broke out two years later that escalated into a full-blown civil war which has crippled the country’s economy and agriculture.
This Red Cross station in Kobok was the only place where people in South Sudan’s Upper Nile region could get medical help, make phone calls, or simply get something to eat. The Red Cross staff treated all patients equally, regardless of whether they were soldiers or civilians.
Unfortunately, the hospital was destroyed by government forces three weeks after our crew filmed it.
Follow: https://t.me/rtdocumentary
🇨🇳#China - 🇸🇸#SouthSudan: Chinese troops from the 12th Chinese Peacekeeping Infantry Battalion under UNMISS (UN mission in South Sudan) conducted live-fire training in South Sudan last week.
UNMISS has been in the country since 2011 to protect civilians and support stability. The Chinese contingent previously drew major attention after the July 2016 Juba violence, when internal UN findings said Chinese and Ethiopian peacekeepers did not leave their bases to assist civilians despite orders to intervene.
An aid workers’ compound only a few hundred meters from a UN base received no help despite repeated distress calls and a survivor personally reaching the base and pleading for help. Multiple civilians, as well as a journalist, were killed during the clashes at that time.
🇷🇺🇸🇸 The Ambassador of Russia to South Sudan, A.Kosmodemiyanskiy, met with the Minister of Presidential Affairs of South Sudan, Africano Mande Gedima.
🔸 During the friendly and constructive discussion, current issues of bilateral relations were addressed.
🔸A.Kosmodemiyanskiy handed over to the Minister a copy of the personal invitationfrom the President of the Russian Federation, Vladimir Putin, to the President of South Sudan, Salva Kiir Mayardit, to attend the Third Russia-Africa Summit, which will take place in Moscow in October this year.
🔸 Following the meeting, the parties agreed to expand political, economic, and cultural cooperation between the two countries, as well as to arrange training in Russia for staffof the National Elections Commission of South Sudan in preparation for the upcoming presidential elections in December this year.
#Africa#Russia#SouthSudan
Ethiopia, South Sudan To Fast Track Implementing Agreements. Read more.
https://borkena.com/2026/04/26/ethiopia-south-sudan-to-fast-track-implementing-agreements/#Ethiopia#SouthSudan#SouthSudanNews#EthiopianNews#economicintegration#cooperation
Africa Cup of Nations - Qualification🌍
2026-03-29 13:00 UTC
South Sudan vs. Djibouti
Predicted outcome: South Sudan❌
Predicted score: 4:0
Actual: Djibouti 0:1
#SouthSudan#Djibouti
2026-03-29 15:00 UTC
Lesotho vs. Seychelles
Predicted outcome: Draw❌
Predicted score: 0:0
Actual: Lesotho 2:1
#Lesotho#Seychelles
#Football#AfricaCupofNations
Africa Cup of Nations - Qualification🌍
2026-03-26 13:00 UTC
Djibouti vs. South Sudan
Predicted outcome: South Sudan✅
Predicted score: 1:3
Actual: South Sudan 0:4
#Djibouti#SouthSudan
2026-03-26 14:00 UTC
Seychelles vs. Lesotho
Predicted outcome: Lesotho❌
Predicted score: 0:2
Actual: Draw 0:0
#Seychelles#Lesotho
#Football#AfricaCupofNations