Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
Your once-a-year chance is here, little cryptos: 33% off all Nomis Scores minting, 50% cashback, and limited offers = Black Friday Mania! 🛍
JUMP ON THE 72H SALE -->
🔗nomis.cc
How to make the most of your discounted Scores? The guide👇
1️⃣ TonHedge x Nomis – 10% Fee Discount
🔗Get Here Now
2️⃣ OmniBadge x Nomis – 300 Honors per user
🔗Get Here Now
3️⃣ Money Toon x Nomis – 500 OWP, SL Membership, 1 EGG with a chance to earn OWP, Automatic Mining
🔗Get Here Now
4️⃣ Hybrid Savings x Nomis – unique Black Friday offers!
🔗Get Here Now
5️⃣ DeGuard VPN x Nomis – Free DeGuard VPN annual plans to first 250 users!
🔗 Get Here Now
6️⃣ GVWS x Nomis – 5 winners share $125, another 50 receive 100 Nomis Emanations!
🔗Get Here Now
What's the SMARTEST Black Friday move? ✍️
💅 Utilize your #TON, #Linea, and #Multichain Scores for VIP shopping at MOSO!
Black Friday comes once a year! Make it count 💜 Make your family proud
💠Nomis tApp | X | Discord | YouTube | Check Scores⚖️
🆕http://evm.ink now fully supports TokenPocket Wallet login and http://evm.ink is also listed on the TokenPocket #Inscriptions List!
👉https://www.tokenpocket.pro/
evmink is a #multichain#inscriptions indexer and marketplace. It has surpassed 270 million inscriptions and has more than 500,000 monthly unique wallet/visitors. Now users can explore #Inscription on BNBCHAIN, ethereum, and 0xPolygonLabs.
👉https://evm.ink/
【Details】https://twitter.com/TokenPocket_TP/status/1735241797901996541
【Powered By】Crypto Box
🎙THEFABLED
Part 2 of our behind the scenes!⚔️
We’ve gotten a lot of questions about $ABYS, #NFTs, and being a #Multichain game with @XenumChain
- This should help explain.
👉Follow up Twitter: https://twitter.com/thefablednft/status/1549792299889987584?s=20&t=AETnQwJZ6rmvm29_SIsIRw
👉Check out our team below, found on our Whitepaper! https://bit.ly/3RRTVon
#Gaming#P2E#Cryptocurrency
The Fabled 💥
We're thrilled to share that we are building with@BNBCHAIN!⚔️🏹
We're excited to welcome the #Binance community to The Fabled. Join our Discord for more updates and BTS! http://discord.gg/h7MxCHDcJu
#UE5#MultiChain#Web3#P2E#BNB
#Anyswap#MultiChain
Urgent notice from Multichai (formerly AnySwap)
#WETH , #PERI , #OMT , #WBNB , #MATIC , #AVAX
6 tokens were found to be vulnerable
If you approve, you need to connect to here ( https://app.multichain.org/#/approvals ) to cancel.
如果你曾经在anyswap使用过这六个代币跨链,那么请点击https://app.multichain.org/#/approvals ,并取消授权。已经有个人账户被攻击导致资金损失。
🚀 TRON Network Implements Proposal 106 to Enhance Compatibility
TRON Network has officially passed Proposal 106 as of April 10 at 20:00 UTC+8. According to ChainCatcher, the mainnet has adjusted the behavior and execution cost of the SELFDESTRUCT instruction. Contracts will only be permanently removed from the blockchain if the instruction is called within the same transaction as the contract's creation. Otherwise, executing the instruction will merely transfer the assets within the contract to a specified address, without deleting the contract itself. Additionally, the energy consumption for SELFDESTRUCT has been changed from 0 to 5000.
This adjustment aligns TRON's mechanisms more closely with Ethereum, enhancing the compatibility of the TRON Virtual Machine (TVM). It aims to provide more stable foundational support for multi-chain development and ecosystem adaptation.
#TRON#Proposal106#Blockchain#Ethereum#TVM#SELFDESTRUCT#Mainnet#MultiChain#Ecosystem#Crypto#ETH#TRX