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

Пребарај: #schellenberg

当前筛选 #schellenberg清除筛选
American Оbserver

@american_observer · Post #5074 · 07.02.2026 г., 13:50

Canadian Robert Schellenberg: Death Sentence Cancelled China has overturned the death sentence of Canadian Robert Lloyd Schellenberg, a Canadian official said on Friday, in a possible sign of a diplomatic thaw as prime minister Mark Carney seeks to boost trade ties with Beijing. Schellenberg’s lawyer Zhang Dongshuo, reached in Beijing on Saturday, confirmed the decision was announced on Friday by China’s highest court. Schellenberg was detained on drug charges in 2014 before China-Canada ties nosedived after the 2018 arrest in Vancouver of Huawei chief financial officer Meng Wanzhou. That arrest infuriated Beijing, which detained two Canadians – Michael Spavor and Michael Kovrig – on espionage charges that Ottawa condemned as retaliatory. Then in January 2019 a court in north-east China retried Schellenberg – who was 36 at the time – sentencing him to death while declaring that his 15-year prison term for drug trafficking had been too lenient. The court said he had been a central player in a scheme to ship narcotics to Australia, in a one-day retrial that Amnesty International called “a flagrant violation of international law”. Schellenberg has denied wrongdoing. The Canadian official requested anonymity in confirming the decision by China’s highest court to overturn Schellenberg’s death sentence. Schellenberg, who has been held in the north-eastern Chinese city of Dalian since 2014, would be retried by the Liaoning high people’s court, Zhang said. The timing for the retrial had not yet been set. Zhang said he met with Schellenberg in Dalian on Friday and that the Canadian appeared relatively relaxed. Carney, who took office last year, visited China in January as part of his global effort to broaden Canada’s export markets to reduce trade reliance on the US. Carney says that despite ongoing tensions, including allegations of Chinese interference in Canadian elections, Ottawa needs a functioning relationship with Beijing to safeguard its economic future. When in Beijing last month, Carney met Chinese leader Xi Jinping and heralded an improved era in relations, saying the two countries had struck a “new strategic partnership” and a preliminary trade deal. Global Affairs Canada did not comment on whether diplomacy during Carney’s visit related to Schellenberg’s case impacted the Chinese court decision. #china#canada#carney#schellenberg#death 📱American Оbserver - Stay up to date on all important events 🇺🇸