Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
Lookonchain | ꘜ
BTC just broke through $124,000, setting a new all-time high!
If you bought #Bitcoin every day like the El Salvador government, you'd have a 115% return!
Since Nov 18, 2022, El Salvador has been buying 1 $BTC per day — buying 1,000 $BTC(cost $57.29M, now worth $124M) at an average price of $57,793, with an unrealized profit of $66M(+115%).
https://intel.arkm.com/explorer/entity/el-salvador
An Satoshi-era #Bitcoin OG moved 1,000 $BTC worth $74.03M to 2 newly created wallets and is likely preparing to sell.
The wallet still holds 1,833 $BTC worth $135.6M.
https://intel.arkm.com/explorer/address/bc1qczar85zjppfjr8df8qnc4l3h5r957v6p2udryz
https://x.com/OnchainLens/status/2044355669982380083
Follow @OnchainLens for more Onchain Updates.
Erik Voorhees(@ErikVoorhees), an early #Bitcoin supporter and founder of ShapeShift, is buying back $ETH after a one-year break.
One year ago, he sold 12,886 $ETH($42.83M) at $3,324.
In the past 5 days, he has spent 17.75M $USDT to buy back 8,576 $ETH at $2,069.
He still holds 26.77M $USDT and may buy more $ETH.
https://intel.arkm.com/explorer/address/0x431dcE06f8A098C6f70CA6CecdCa87281eF10c91
Charles Schwab increased his position in the financial company Strategy $MSTR of #Bitcoin by 91,559 to 1.27 million shares ($168 million).
Charles Schwab, who oversees trillions in client assets, increased his position in Strategy ($MSTR) by 91,859 shares, raising his total holdings to 1.27 million shares worth around $168 million.
Strategy is widely known for its large Bitcoin treasury strategy, making MSTR an important proxy vehicle for institutional engagement in Bitcoin via traditional stock markets.
Analysts say that Schwab's increased allocation reflects the ongoing institutional confidence in Bitcoin-related stocks and reinforces a deeper integration between traditional finance and digital asset-based corporate strategies.
🥳@Runlifenick_fx✅
🐱🙏🐶🚨
Michael Saylor says, “You’ve got 10 years for the digital gold rush, you should get your #Bitcoin before there’s no more Bitcoin for you.” 🤯
🌍t.me/Runlifenick_fx✅
BULLISH: 🟠 Billionaire Michael Saylor says $1 million #Bitcoin price is inevitable.
“It will grow from $2 trillion to 20 trillion to $200 trillion” 🚀
Source: @Runlifenick_fx✅