TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #76 · 27 апр.

Ранее я делал серию постов про битовые операторы. Вот вам ещё один наглядный пример как это используется в 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

Резултати

Пронајдени 1 слични објави

Пребарај: #vivektavinita

当前筛选 #vivektavinita清除筛选
Pensive|

@PensivePost · Post #5848 · 08.07.2022 г., 21:06

I rushed down stairs. The wild energy around her was affecting me. Not only affecting me but turning me into the perfect dumbass. So I thought its good idea if I catch up with my buddy before a vapourising. Reaching on the last step, I looked up at the direction of my room. One second... What she is doing in my room? Rubbing the temple of my head, I dismiss all the cascading thoughts and marched towards the kitchen. "Oww, Holy hell" One second I was marching with my head held high and now I was embracing the pavement. Wow just great. I haven't been this lucky in my whole life. And suddenly I was showered with the God's grace. And I don't think I like it. "Sir...what are you doing on the floor" A very confused Lola, inquired with the bucket that she just emptied on me "I'm kissing the floor, Lola" I replied politely, well my system is shaken now, especially the one which is responsible for my emotions and feelings. "How did you fell ?" Vivek asked in very concerned voice, rushing to me. "No Vivek sir he is not fallen, he is just kissing the floor" Lola beamed from somewhere and I didn't even had energy to facepalm. " And why you are wet?" He inquired " Ohh wow he talks " My lips formed in knowing smile, well it's more like a grin. Actually I was just taunting him. for turning my life upside down. A if it wasn't already. "Yeah sir he talks very much and politely" She beamed again from somewhere and I couldn't do anything more than sighing "Why you are wet? " Vivek asked again ignoring Lola. He is really good in ignoring people. "It's God's grace in liquid form" I murmured, sinking my body in floor. "No sir I just dropped water on him that I was using for cleaning" Stupid woman chirped again, it's better if she murders herself because I will do it brutally and she won't like it, I don't even need to say how ruthless I'm, That idiot doesn't know when to use her mouth and mind, but I'm not even sure if she has mind. #Vivektavinita#Review#paragraph#novel