Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
Welcome to the Official TRUELAB GAMES Telegram Channel!
A NEW ERA IS COMING!
This channel will be your VIP pass to the most thrilling adventures TrueLab has in store.
Here’s what to expect:
🎮 Sneak peeks into works-in-progress and behind-the-scenes action, where pixels meet passion.
🏆 Exclusive heads-up on upcoming tournaments with tips to keep you ahead of the game.
🌐 First-hand announcements about promotions to enhance your TrueLab gaming experience.
🔥 Early alerts on new additions to our TRUE line of products – be the first to know and experience!
Join the conversation, share your thoughts, and stay tuned – the future of TRUE is now, and it’s #TRUEtotheCore.
🔗 Stay connected. Stay informed. Stay TRUE.
#TrueLabNewEra#GameOn
🎮 Attention Gamers! 📸 Big 200 Go!Bots giveaway!! Capture Epic Moments and Win Big! 🏆
📢 Get ready for the ultimate gaming challenge! Introducing the 🌟 EA Games Screenshot Challenge 🌟 brought to you by Health Hero. 🎉 Show off your gaming skills, share your most jaw-dropping EA Games screenshots, and earn 💪 Health Hero rewards!
Starts: Tuesday, June 20, 2023
Ends: Tuesday, June 23, 2023
📸How to participate? Visit https://zealy.io/c/healthhero-7008/questboard to get your quests started!
📢 Don't wait! Grab your gaming gear, start snapping those jaw-dropping screenshots, and let the gaming magic begin! 🚀✨
📢 Disclaimer: This challenge is purely for gaming enthusiasts and is not endorsed or affiliated with EA Games. It's all about celebrating our shared love for gaming and having a blast together!
🎮📸#GamingHeroes#EAGameScreenshotChallenge#HealthHero#CaptureTheMoment#LevelUp#GameOn
🇺🇿◽️2️⃣2️⃣2️⃣
Level Up Your Life!
Bored? Feeling stuck? ➡️ Level up your LIFE with CHESS! ♟ Our Chess Club isn't just about moving pieces; it's about strategy, friends, & unlocking YOUR potential! 💪
Whether you're a total beginner 👶 or a grandmaster in disguise 🕵️♂️, we welcome ALL skill levels.
What are you waiting for? 🤔
https://tally.so/r/mJQNq7
◽️🔤🔤🔤🔤🔤🔤🔤🔤🔤🔤
🇺🇿Inha yoshlar ittifoqi
Join us on social media
🌐Telegram | 🌐Instagram
#ChessClub#Chess#BoardGames#Strategy#NewMembersWelcome#Fun#BrainPower#GameOn#ChessLife
AI Startup Founder Arrested for Fraud
GameOn co-founder Alex Beckman and wife indicted for fraud in US. Allegedly misused $4M of $125M raised, using funds for luxury purchases, including a home, cars, and wedding. Prosecutors claim Beckman falsified company financials, overstating revenue and creating fake documents. GameOn's operations halted with layoffs after investigation into missing funds. Beckman's claims of acting in company's best interest questioned. Full details on the indictment can be found here.
#AI#Startup#Fraud#Investment#GameOn#Beckman#Technology#Business#News#Legal#Indictment#TechIndustry#Innovation#Data#Investors#VC#Fintech#SanFrancisco#Luxury#FraudulentAccounting
⬆️ С 11 сентября по 30 сентября в компьютерном клубе Net Arena проходит акция — всем новым участникам клуба в микрорайоне Кожухово дарим 2 часа игрового времени в подарок!
🏆 Приходите и наслаждайтесь современными играми на мощных ПК и консолях. Не упустите свой шанс окунуться в мир виртуальных приключений!
📦 Ждем вас в нашем клубе! Приводите друзей и получайте еще больше бонусов!
🔍
Все подробности по телефону +74950808404 и в нашем телеграм-канале: @netarenaclub | ул. Дмитриевского, 1
#NetArena#КомпьютерныйКлуб#Геймеры#Акция#ИгровоеВремя#Кожухово#Игры#ГеймерыРоссии#Киберспорт#Gaming#PlayStation#PCGaming#GameOn