Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
#CELR/USDT analysis :
#CELR is currently forming a triangle pattern. A breakout from this pattern is anticipated, with the price expected to test previous highs. A long entry is recommended upon a breakout above the $0.02130 level.
TF : 1D
Entry : $0.02130
Target : $0.03180
SL : $0.01695
#CELR/USDT analysis :
#CELR is currently in a downtrend, trading below the 200 EMA. The price is currently facing resistance in this zone. It is expected to reverse from this point and continue its bearish trend to test previous lows. Wait for a breakout below the $0.01114 level to consider going short.
TF : 4H
Entry : $0.01114
Target : $0.01014
SL : $0.01169
#CELR/USDT analysis :
#CELR is in a downtrend, trading below the 200 EMA. The price is forming LLs and LHs structure. Before continuing its bearish momentum, the price is expected to experience a pullback and test the resistance zone. Wait for the pullback for a short entry.
TF : 1H
Entry : $0.01142
Target : $0.01043
SL : $0.01177
#CELR/USDT analysis -
#CELR is in a downtrend, trading below the 200 EMA. The price is currently approaching a resistance zone. It is expected to be rejected from there and continue the bearish momentum towards the previous lows.
TF : 4h
Entry : $0.0157
Target : $0.0129
SL : $0.0164
#CELR/USDT BUY SETUP
CELR has broken out of the descending triangle and is currently testing it. A successful test will confirm a bullish move. Get ready for takeoff. 🚀