Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
🔥NEW RELEASE🔥
😁Systematically Dismantling Octopus Guard & Other Low-Percentage Moves by Gordon Ryan😁
➡️Systematically Dismantling Octopus Guard & Other Low-Percentage Moves is Gordon Ryan’s blueprint for shutting down hype-driven positions and forcing your opponents back into reality.
➡️Gordon also addresses a range of increasingly popular “low-percentage” techniques that are flooding competitions and social media. Instead of simply dismissing them, he shows you exactly why they fail — and how to counter them with tight mechanics, superior positioning, and intelligent pressure.
$349😍$24.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
👑MasterClass
✈️@bjjfanaticsinstructionals
#GordonRyan#Escapes#NoGi#NewWave
💁♀️Buy
💁♀️
🔥NEW RELEASE🔥
😁Can't Keep Me Down Escaping Pins by Garry Tonon😁
➡️Known worldwide for his fearless approach and jaw-dropping escapes, Garry thrives in positions others fear. His unique system is built on embracing pressure and turning precarious situations into opportunities to regain control and dominate.
➡️In this must-have release, Garry breaks down his world-class escape strategies, showcasing the exact techniques that have defined his career, including his unforgettable battle with Palhares — a match that cemented his reputation as possibly the greatest escape artist in Brazilian Jiu-Jitsu history.
➡️Whether you’re caught under a heavy mount or trapped in a brutal pin, Can’t Keep Me Down teaches you how to stay calm, create space, and execute escapes that flip the script and put you in the driver’s seat. If you want to add a relentless, never-say-die mindset and world-class escapes to your arsenal, this instructional is your blueprint.
$197😍$14.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
🌈UFC Picks
👑MasterClass
✈️@bjjfanaticsinstructionals
#GarryTonon#Escapes#NoGi#NewWave
💁♀️Buy
💁♀️
🐈⬛NEW RELEASE
🐈⬛
🐈⬛Drill for Skill Chest to Chest Pin Escapes by Placido Santos
🐈⬛
🐈⬛In Drill for Skill: Chest-to-Chest Pin Escapes, Placido Santos delivers a complete escape system that combines world-class instruction with structured drilling progressions—so you don’t just understand escapes… you can execute them when it matters.
🐈⬛Known to many as John Danaher’s trusted uke, Placido is far more than that—he’s a high-level competitor and one of the most detail-oriented students of Danaher’s system, alongside names like Gordon Ryan, Giancarlo Bodoni, and Brian Glick.
$197
🐈⬛$14.99
🐈⬛
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱📱
💰Submeta FOR FREE
👑MasterClass
✈️@bjjfanaticsinstructionals
#PlacidoSantos#Escapes#NoGi#NewWave
🐈⬛Buy
🐈⬛
😁Ninja Escapes by Kenta Iwamoto😁
➡️Unlock the secrets to flawless back escapes and turtle escapes with Ninja Escapes by Kenta Iwamoto — a masterful Brazilian Jiu-Jitsu instructional series designed to elevate your defensive game
➡️Whether you find yourself trapped in a tight back control or stuck in the turtle position, this detailed program breaks down escape techniques with precision and clarity.
̶$̶7̶9̶😍$9.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
🌈UFC Picks
👑MasterClass
✈️@bjjfanaticsinstructionals
#KentaIwamoto#Escapes#NoGi#BTeam
💁♀️Buy
💁♀️
🔥NEW RELEASE🔥
😁Pins And Dominant Position Escape Engineering by Adam Wardziński😁
➡️Turn the Tide from the Bottom — Learn Elite-Level Escape Systems from One of the Most Battle-Tested Gi Competitors in the World
➡️In Pins and Dominant Position Escape Engineering, Adam breaks down his battle-tested escapes from side control, mount, back control, knee-on-belly, and more — all with the clarity, detail, and realism you'd expect from someone who’s done it at the highest level.
$147😍$11.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
👑MasterClass
✈️@bjjfanaticsinstructionals
#AdamWardzinski#Escapes#Gi#IBJJF
💁♀️Buy
💁♀️
https://pypi.python.org/pypi/bleach
Bleach is a allowed-list-based #HTML sanitizing library that #escapes or #strips markup and attributes.
Bleach can also linkify text safely, applying #filters that #Django’s urlize filter cannot, and optionally setting rel attributes, even on links already in the text.
#Bleach is intended for sanitizing text from untrusted sources. If you find yourself jumping through hoops to allow your site administrators to do lots of things, you’re probably outside the use cases. Either trust those users, or don’t.