Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
#HOOK/USDT analysis :
#HOOK has successfully broken out from the trendline and subsequently retested it, indicating a shift in direction towards the upside.
This suggests that bullish momentum is likely to persist, with potential for testing higher price levels in the near future.
TF : 4h
Entry : $0.2850
Target : $0.3240
SL : $0.2716
#HOOK/USDT analysis :
#HOOK is in a downtrend, trading below the 200 EMA. The price is currently experiencing a pullback and is expected to test the resistance zone before continuing its bearish trend. The price is expected to test the resistance zone while continuing its bearish momentum to test previous lows.
TF : 4H
Entry : $0.4173
Target : $0.3485
SL : $0.4477
#HOOK/USDT analysis :
#HOOK is in a downtrend, expected to keep up its bearish momentum. The price has already broken out of the trendline, triggering the entry. Target the previous swing low as a potential target level.
TF : 15min
Entry : $0.3558
Target : $0.3208
SL : $0.3746
#HOOK/USDT analysis :
#HOOK has broken out of the trendline with impulsive bullish momentum. It is expected to test the previous swing high. Aim for it as a potential target level, as bullish momentum is expected to continue on LTF.
TF : 5min
Entry : $0.3475
Target : $0.3696
SL : $0.3332
#HOOK/USDT analysis -
#HOOK shows a rejection from the resistance zone after establishing a lower low. There is an anticipation of further decline from this point with a potential retest of the previous low. For a short entry, wait for a pullback to the resistance zone.
TF : 2h
Entry : $0.4959
Target : $0.4003
SL : $0.5155
#HOOK/USDT analysis -
#HOOK is currently in a downtrend, hitting new lows and trading below the 200 EMA. The price is currently testing the resistance zone after an impulsive move. It is anticipated that the price will reject from there and continue to test new lows shortly. Enter when the price begins declining from the resistance zone. The previous swing low will be the target level.
TF : 1h
Entry : $0.5767
Target : $0.5316
SL : $0.6036
#HOOK/USDT analysis -
#HOOK is in a downtrend, trading below the 200 EMA. The price is currently going through a pullback and has retraced to previous support levels near the 200 EMA. Currently, the price is encountering resistance near the 200 EMA and has already broken the trendline, indicating an increase in bearish pressure on the price. To confirm entry, wait for the price to break below the $0.5997 level to go short, with previous swing lows as potential target levels.
TF : 30min
Entry : $0.5997
Target : $0.5446
SL : $0.6337