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 слични објави

Пребарај: #rogachev

当前筛选 #rogachev清除筛选
Russian Consulate in Cape Town

@rusconct · Post #1765 · 01.08.2024 г., 16:56

LESSONS OF HISTORY REPEATED ✍️Article by Ambassador of Russia to South Africa Ilya Rogachev (31 July 2024) READ IN FULL Key points: 🔹 Obsessed with the idea to inflict a military defeat upon Russia and split it into several smaller states with limited sovereignty, the collective West is heading towards a war against Russia, and decisions of the latest NATO summit in Washington D.C. corroborate that. "Europe is preparing for war. The pro-war train has no brakes, and the driver has gone mad” - Hungary’s Premier V.Orban". 🔹There is a very common opinion in Russia that approximately once in a centenary, the West braces up and comes to the Russian soil with a sword, where it gets beaten up and retires with its nose bloodied to remain calm for another 100 years. 🔹The Time of Troubles in Russia (XVII century) was accompanied by foreign military interventions (Poland, Sweden) which endangered the very existence of Russia as a sovereign state. But in 1612 people’s militia ousted the invaders. 🔹The XVIII century saw yet another major clash with Europeans known as the Great Northern War. During Swedish King Charles XII’s Russian campaign, in 1709, the army of invaders was completely decimated by Russian troops under the command of Peter the Great. 🔹In about 100 years, a new attempt to clamp Russia was made as Napoleon Bonaparte of France in 1812 led his ‘Grand Army’ into the ill-fated invasion. 600,000 soldiers of his army came to Russia in June 1812, and in only 6 months their remnants were chased away by Field Marshal Kutuzov’s troops. In 1814, the Russian army entered Paris. 🔹The XX century saw another large-scale invasion of Russia from the West. Our country survived World War I accompanied by inner political turmoil with three revolutions, the Civil War and foreign military interventions involving UK, France, USA etc. ☝️ Only two decades later Nazi Germany attacked the USSR. Hitler intended to conquer the USSR by the end of 1941, but it didn’t turn out the way he expected. On 30 April 1945, as the Red Army was storming Berlin, he committed suicide in the basement of the Reich Chancellery. 👉 Russian historian V.Klyuchevsky once wrote that history does not teach any lessons but punishes one for not learning them. The West should stop rewriting history and start learning it, in order to prevent history from repeating itself every 100 years. #alternativeviewpoint#embassyofrussia#rogachev#russia#southafrica