Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
🏴Intensa jornada en el mercado de fichajes de la Premier League:
🇧🇪Sebastian Bornauw (26 años) ficha por el Leeds. El acuerdo con el Wolfsburg y los 'whites' se cierra por cerca de €6M.
🏴El delantero escocés Dan Cummings (19 años) es nuevo refuerzo del West Ham. Llega libre tras terminar contrato con el Celtic.
🇸🇳Habib Diarra (21 años) ficha por el Sunderland. Han pagado casi €32M por el mediocampista al Estrasburgo, lo que lo convierte en el fichaje más caro de la historia de los 'black cats'.
🇳🇱El delantero Zepiqueno Redmond (19 años) llega al Aston Villa como agente libre tras quedar desvinculado del Feyenoord.
@LaGuiadelFutbol | #PremierLeague
⚡️Fanton EN: Premier League Gameweek 35 Overview
#PremierLeague#fantasy
Fanton EN presents a preview of Premier League Gameweek 35, covering key matches like Leicester vs. Southampton, Chelsea vs. Liverpool, Brighton vs. Newcastle, and Crystal Palace vs. Nottingham Forest. Each game carries significant implications for fantasy lineups, with Liverpool, Newcastle, and Nottingham still battling for crucial spots.
Source: link
@tonlines
Manchester City es campeón por 4ta vez consecutiva en la Premier League, luego de vencer 3-1 al West Ham
@Fut_planet⚜️#PremierLeague🏴#City🏴
Title races are rarely decided by headlines alone.
Probability shifts long before the table confirms it.
#ManchesterCity#PremierLeague#EdgeMarket#PredictionMarkets
Después de una temporada dónde veíamos al Chelsea de mal en peor logró lo que se veía imposible
Venció 2-1 al Bournemouth, y con un golazo de Moisés Caicedo el conjunto londinense se clasificó a la próxima edición de la UEFA Europa League🟠
@Fut_planet⚜️#PremierLeague🏴#Chelsea🏴#UEL🟠
England Premier League🏴
2026-05-13 19:00 UTC
Manchester City vs. Crystal Palace
Predicted outcome: Manchester City✅
Predicted score: 3:1
Actual: Manchester City 3:0
#ManchesterCity#CrystalPalace
#Football#PremierLeague
England Premier League🏴
2026-04-20 19:00 UTC
Crystal Palace vs. West Ham
Predicted outcome: Draw✅
Predicted score: 1:1
Actual: Draw 0:0
#CrystalPalace#WestHam
#Football#PremierLeague
England Premier League🏴
2026-05-11 19:00 UTC
Tottenham vs. Leeds
Predicted outcome: Leeds❌
Predicted score: 1:2
Actual: Draw 1:1
#Tottenham#Leeds
#Football#PremierLeague
England Premier League🏴
2026-05-01 19:00 UTC
Leeds vs. Burnley
Predicted outcome: Leeds✅
Predicted score: 2:1
Actual: Leeds 3:1
#Leeds#Burnley
#Football#PremierLeague