Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
#MDT/USDT analysis :
#MDT is currently in a downtrend making new lows. The bearish momentum is expected to continue, potentially leading to further declines. For a short entry, consider waiting for a test of the resistance level before initiating a short position.
TF : 2H
Entry : $0.02883
Target : $0.02495
SL : $0.03150
#MDT/USDT analysis :
#MDT is currently in a downtrend, consistently forming lower lows (LLs) and lower highs (LHs) below the 200 EMA. The price is anticipated to continue its bearish momentum and test lower levels. It is recommended to wait for a pullback for a short entry opportunity.
TF : 4H
Entry : $0.05060
Target : $0.04127
SL : $0.05536
#MDT/USDT analysis :
#MDT is currently in an uptrend, characterized by the formation of higher highs (HHs) and higher lows (HLs). The price has retraced to test the 200 EMA, successfully forming a higher low before bouncing back. Wait for a breakout of the trendline, as the price is anticipated to test the previous swing high.
TF : 4H
Entry : $0.06650
Target : $0.08500
SL : $0.05715
#MDT/USDT analysis :
#MDT is in an uptrend, forming higher highs (HHs) and higher lows (HLs) above the 200 EMA. The price has recently tested the support zone and has bounced back from that level. It is anticipated that the bullish momentum will continue, leading to a potential test of previous highs.
TF : 2h
Entry : $0.05624
Target : $0.06177
SL : $0.05297
#MDT/USDT analysis :
#MDT is currently retracing back to the 200 EMA while forming higher highs (HHs) and higher lows (HLs) in its structure. The price is bouncing back from the support zone and is expected to test the previous swing high.
TF : 1D
Entry : $0.04253
Target : $0.05229
SL : $0.03668
#MDT/USDT analysis :
Based on the current market analysis, #MDT is currently experiencing a downtrend, trading below the 200 EMA. Following a correction phase, the price has been rejected from the 200 EMA. The anticipated next move is for the downtrend to persist with an impulsive movement, potentially testing previous lows.
TF : 4H
Entry : $0.0364
Target : $0.0290
SL : $0.0405
#MDT reached the ceiling of the trading range on 12H Time frame,we expect another bullish movement incoming..🚀
❄️@signals_bitcoin_crypto❄️
❄️@Shadow_support0o❄️