Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
#WOO/USDT analysis :
#WOO is currently trading within a channel, and a retracement to the 200 EMA is pending. The price is likely to move upward and test the previous swing high resistance, with expectations for continued upward movement.
TF : 1D
Entry : $0.1629
Target : $0.2186
SL : $0.1469
#WOO Failure Swing Detection 👇
The chart fully and automatically generated by our algorithm.
All drawings are based on only mathematical values and calculations instead of emotions.
Interested?
www.coinlegs.com
#WOO bounced back from the Weekly Trendline and now hitted the Supply zone,in the case of breakout we will see another pump.🚀
otherwise wait to see the price reaction to the trendline again.👀
❄️@signals_bitcoin_crypto❄️
❄️@Shadow_support0o❄️
#WOO/USDT UPDATE:
#WOO is now trading around 0.45$. #WOO has broken down of a bear flag on hourly time frame. Now the Possible scenario is according to the pattern, we can see 10-20% dump in this. Keep eye on it 👀Stay tuned with us for further updates✔️
#WOO/USDT UPDATE:
#WOO is now trading around 0.454$. $WOO has formed a bear flag pattern on the hourly time frame. So the Possible scenario is If the price dumps and breaks down the pattern, we can see a dump in it. Keep eye on it👀. Stay tuned with us for further updates✔️