Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
Join us in 20 minutes to explore the meme ecosystem on #BSC with @LordCheems_Bsc & @Testonbsc! 👀
⏰ 1PM UTC+0
📅 Tuesday, February 11th
📍https://x.com/i/spaces/1BdGYqlaOeXGX
🔜 Tune in to our BNB AMA today to learn about #BSC Governance and discover how you can get involved!
⏰ 1PM UTC
📅 Today, October 24th
📍 BNB Chain X, YouTube, & Binance Live
🔗https://youtube.com/watch?v=vmS1TPNKt4s&ab_channel=BNBChain%28Official%29
🚨 The final sunset of BNB Beacon Chain is set for mid-November!
Migrate your assets to #BSC to avoid losses.
Learn about the asset migration process and necessary actions for users and CEXes on the blog below! 👇
https://www.bnbchain.org/en/blog/final-sunset-plan-of-bnb-beacon-chain
🔥🔥🔥LIVE ON 8 SEPTEMBER (9PM GMT+3) 🔥🔥🔥
TIPSY Token #BSC on 🥞PancakeSwap!!!
The First Blockchain-based Adult-Friendly Entertainment Ecosystem.
Tipsy is an app store - and a place where adults have fun!
It's an open-source marketplace for adult entertainment.
It's a platform where developers can create and deploy apps and games, merchants can sell goods and models can upload and share media or offer services such as video chat.
Tipsy is an ecosystem - with interoperability between apps and games
✅Certik Audited
✅Low MC
✅Very Low Circulating Supply
✅Vesting(Double your Tokens)
✅NFT
🚀 CEX Listing
🔗 Virtual Land Sale
❤️ TipsyFans
🌎 TipsyWorld
📞 Telegram: https://t.me/tipsyonline
🌐 Website: tipsyonline.io
🐦 Twitter: twitter.com/TipsyLabs
🎥 YouTube: https://youtu.be/-uBU3s5uSPk
👋
✅ WELLCOME TO ✅
💯$HGT
✅ PRE-SALE COMING
🚨$HGT — backed by more than hype. It’s backed by gold.
👉 From the producing Hellyer Mine in Tasmania 🇦🇺, $HGT gives you exposure to tokenized gold, lead & zinc — all secured by audited reserves.
🌱 Built on #BSC, powered by hydroelectric energy
🔒 Audited reserves. Institutional custody.
🟢 Gold-backed stablecoin launching in Phase2
🔥 Pre-sale COMING — limited allocation, real utility
🕊Twitter
https://x.com/Hellyergold
🔵Telegram
https://t.me/HGTToken
🌐Website
https://hellyertoken.co/
🚀 New Gem 💎 : Daddy Cake
💲 Total Supply: 1,000,000,000,000,000
⏱ End date : Aug 15th, 2021
⏳ Distribution Date : Sep 1st, 2021
🔘 Rate : ⭐️⭐️⭐️⭐️⭐️
🏚 Aidrop :
🔸 Fill in the form with your details:
https://forms.gle/uzEC2Kp33xiySegp7
🔸 Join the Telegram group:
@DaddyCake_Chat
🔸 Join the Telegram channel :
@daddycakechannel
🔸 Buy:
https://pancakeswap.finance/swap?outputCurrency=0x98899de44fdfe52b385fbe53c82042bbbcb8e673
🔸 Follow the Twitter account:
https://twitter.com/daddycake_bsc?s=21
🔸 Retweet our pinned post on your Twitter account & tag 5 friends.
📑Additional Information:
DaddyCake.io - Meme that’s Hyper deflationary with built in smart staking system, hold, pet, love, & save dogs! on #BSC
Contract:
0x98899de44fdfe52b385fbe53c82042bbbcb8e673