TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #76 · 27 апр.

Ранее я делал серию постов про битовые операторы. Вот вам ещё один наглядный пример как это используется в 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

Резултати

Пронајдени 3 слични објави

Пребарај: #baath

当前筛选 #baath清除筛选

Today, the funeral ceremony of 280 unknown martyrs was held in some cities of Iran with the presence of the president. The bodies of these martyrs have recently been discovered from under the ground in war zones. Despite the "DNA" test, some of the martyrs are still unknown. Because they don't know where their families are. In 1980, Iraq attacked Iran at the instigation of the #United_States with the cooperation of all #Sunni Arab countries to overthrow the Iranian Shiite government, but they did not achieve their goal. This war imposed on Iran was carried out with the participation of 80 countries and ended in 1988 with one million dead and wounded. Today, there is neither Saddam Hussein nor the terrorist #Baath Party of Iraq. But the more powerful Islamic Republic is fighting the Israeli terrorists in #Jerusalem since 1988. https://t.me/YediotNewsChat

Ultimora.net - POLITICS

@ultimoraPOLITICS · Post #39571 · 16.05.2022 г., 21:55

#Elezioni#Libano 99 seggi assegnati su 128: Per coalizioni: Alleanza dell'8 marzo (#FPM-#Amal-#Hezbollah-#Marada-#ARF-#PNO-#UP-#Baath)|Grande tenda pro-Siria: 47 seggi Alleanza del 14 marzo (#LF-#Kataeb-#IM-#Taqaddm)|Grande tenda anti-Siria: 28 Indipendenti: 11 Altri (#PSP-#NLP-#TW-#Sabaa-#ReLebanon-#Osos): 11 @UltimoraPolitics

Ultimora.net - POLITICS

@ultimoraPOLITICS · Post #39570 · 16.05.2022 г., 21:40

#Elezioni#Libano 99 seggi assegnati su 128: #LF|Destra cristiana: 19 seggi #FPM|Grande tenda cristiana maronita: 14 #Amal|Centro-destra populista islamico: 13 Indipendenti: 13 #Hezbollah|Islamici: 12 #PSP|Centro-sinistra druso: 6 #Kataeb|Centro-destra cristiano maronita: 6 #ARF|Sinistra armena: 3 #Marada|Destra cristiana maronita: 2 #Taqaddm|Centro-sinistra: 2 #UP|Nasseristi: 1 #PNO|Sinistra araba: 1 #NLP|Centro-destra cristiano maronita: 1 #TW|Centro: 1 #Sabaa|Centro-sinistra: 1 #ReLebanon|Centro-destra: 1 #Baath|Neo-Ba'thisti: 1 #Osos|Centro: 1 #IM|Centro-destra sovranista secolare: 1 @UltimoraPolitics