Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
🎬 Life Is Beautiful
Gênero: #Drama, #Italian
⭐️ IMDb: 8.6
⏳ Duração: 1h 56m
📝 Sinopse:
Quando um garçom judeu de mente aberta e seu filho se tornam vítimas do Holocausto, ele usa uma mistura perfeita de vontade, humor e imaginação para proteger seu filho dos perigos ao redor de seu acampamento.
Fonte: IMDb
🔵Inscreva-se em @Assistir
*Patrocinado: Anime Bot
#Ethiopia’s #Bishoftu mega airport secures fresh financing momentum
Ethiopia’s landmark aviation project near Bishoftu is gaining fresh international traction following a recent series of high level engagements in #Rome, where #Italian officials signalled a readiness to support key components of the financing for what is being positioned as #Africa’s most ambitious airport scheme.
This development comes as the project — already under construction — moves from planning into execution mode, and as Addis Abeba’s existing aviation capacity nears its limits.
Announced during formal discussions in mid March 2026 between Ethiopia’s Finance Minister Ahmed Shide and Italy’s Minister of Economy and Finance Giancarlo Giorgetti, Italy’s pledge does not yet amount to a fully executed funding commitment.
Rather, it frames Italian support as being part of a multi layered financing structure under negotiation, with.........
https://aircargoweek.com/ethiopias-bishoftu-mega-airport-secures-fresh-financing-momentum/
Memorial park honoring prominent #Somali anti-colonial leader Sayyid Mohammed Abdullah Hassan inaugurated in #Jigjiga
A new memorial park honoring Sayyid Mohammed Abdullah Hassan, the early 20th century Somali scholar, poet and anti-colonial military leader, has been officially inaugurated in Jigjiga, capital of #Ethiopia’s Somali Regional State.
Known in Somali as Maxamed Cabdulle Xasan, Sayyid Mohammed Abdullah Hassan is know to have founded and led the Dervish movement, which waged armed resistance against #British, #Italian and Ethiopian colonial expansion in the Somali Peninsula.
While widely revered by many Somalis as a symbol of anti-colonial struggle, he was pejoratively labeled the “Mad Mullah” by the British Empire. In 1917, the Ottoman Empire recognized him as the “Emir of the Somali People.”
Regional President Mustafa Muhummed presided over the ribbon-.....
https://web.facebook.com/AddisstandardEng/posts/pfbid035zhG5D71mJR7UdFHybuQqaDPAcU8msaQNqQShDRQ5NYGVkbYXYFHbQGW62n97vmrl
Various Artists — The Archival Recordings of Constantin Brăiloiu (Death Is Not The End, 2024)
#traditional#field_recording#basque#bretton#bulgarian#corsican#ethiopian#flemish#gaelic#georgian#greek#hausa#inuit#irish#italian#kabyle#macedonian#norwegian#romanian#russian#sardinian#sephardic#swiss#tuareg#Brittany#Flanders#Wallonia#Bosnia_and_Herzegovina#Bulgaria#China#England#Ethiopia#France#Georgia#Greece#India#Ireland#Italy#Japan#Macedonia#Norway#Portugal#Romania#Russia#Switzerland#Turkey
Сборник записей пионера румынской этномузыкологии, Константина Браилою. Треки с него впервые прозвучали на радио NTS в июле 2017 года, а в 2024 году лейблDeath Is Not The End выпустил его в формате полноценного альбома в честь своего 10-летия.
Сборник включает полевые записи народных песен и танцев и охватывает музыкальные традиции множества культур: английской, ирландской, гэльской, норвежской, бретонской, японской, итальянской, швейцарской, баскской, сардинской, эстонской, грузинской, греческой, турецкой, сефардской, португальской, французской, китайской, русской, хауса, туарегов, индийской, корсиканской, эфиопской, румынской, валлонской, фламандской, немецкой, кабильской, болгарской, македонской, боснийской и карибу-эскимосской.
Существенная проблема этого релиза заключается в том, что треки не проаннотированы. По этой причине слушателю придется упавать на свою собственную эрудицию и знание языков, чтобы понять, какая композиция принадлежит к какой культуре.
🔗Bandcamp | Telegram