Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
🇹🇼l🇱🇧
Taiwan's Gold Apollo pager company issued a statement stating:
"- The #pagers that exploded in #Lebanon carry our trademark, but they were manufactured in Europe.
- All AP924 Model Pager models were subcontracted to a company in Europe, about 5,000 in that batch to Lebanon.
- The pagers were manufactured in through third party components."
They are trying to clear Taiwan, which is mostly plausible, as Europe was always the hub for the Mossad historically when sabotaging supply chains.
How about naming the European country/manufacturer? Wouldn't that clear the Taiwan based company's name faster?
AP-900: This what we know about one of the #pagers that exploded in #Lebanon at the hands of Zionist Israel:
▫️The AP-900 alphanumeric pager functions as a wireless communication device that receives messages via radio signals.
▫️At least 11 people have been martyred and over 4,000 others, including civilians, medics and Hezbollah members, were injured when their paging devices exploded across Lebanon.
▫️The AP-900, popular in the 1990s and early 2000s, was designed to receive and display text messages, making it an essential communication tool in various professional and emergency settings.
▫️Despite its simplicity, the AP-900 operates on a sophisticated system that ensures messages are delivered promptly and accurately.
▫️A message transmission starts at a central paging terminal, which encodes the message into a signal format like FLEX or POCSAG.
▫️This signal is sent over a specific frequency band, and the AP-900 pager, scanning for signals that match its unique identifier, receives it through its antenna.
▫️The pager then decodes and displays the message on its screen, alerting the user with vibration, sound, or both.
▫️Additionally, the AP-900 can store multiple messages for later review.
▫️Can the AP-900 Be Hacked?
Theoretically, yes, the AP-900 can be hacked, but it would require specialised knowledge and equipment, information from open sources show.
▫️Although the messages are encoded, they are not typically encrypted, meaning that an intercepted message can be easily decoded.
▫️More sophisticated attacks could involve compromising the messaging infrastructure or physically tampering with the devices during distribution.
AP-900 and AR-924 pagers were the latest tool of Israeli attacks against Lebanon. A massive terrorist attack saw the devices exploding among civilians and Hezbollah members in a Mossad-operated aggression.
#Lebanon#Hezbollah#Pagers#Mossad#Israel
For the first time, Israeli Prime Minister Benjamin Netanyahu admitted in a cabinet meeting on Sunday that he stands behind several terrorist attacks against Lebanon such as the assassination of Hezbollah chief and the pagers and walkie-talkies attacks.
#Hezbollah#Nasrallah#Pagers#UnitedStates#Israel#Netanyahu
After terming the Israeli terrorist attack in Lebanon as a declaration of war, Hezbollah Chief Hassan Nasrallah vows a harsh and just punishment upon Israel.
#Hezbollah#Lebanon#Nasrallah#Pagers#Israel#Mossad#Gaza#Palestine
In the first remarks after the Israeli terrorist attack against Lebanon, Hezbollah Secretary General Hassan Nasrallah termed the aggression as a declaration of war from the Israeli side.
#Hezbollah#Lebanon#Nasrallah#Pagers#Israel#Mossad#Gaza#Palestine
A fake market, explosive devices, and a decade-long plot—this is the hidden war #Mossad waged on #Hezbollah.
#Israel#Pagers#Lebanon#MiddleEast#War#PagerBombs