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

Резултати

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

Пребарај: #binaries

当前筛选 #binaries清除筛选
Universe Mysteries 🪐

@cosmomyst · Post #621 · 14.01.2026 г., 12:21

🪐 Deep in the constellation Draco lies the pulsar PSR J2222−0137, a unique spinning neutron star about 900 light-years from Earth that forms a binary system with a faint white dwarf. PSR J2222−0137 spins once every 33 milliseconds, and its partner is one of the coolest known white dwarfs, so cold that its surface may be made of crystallized oxygen—offering a rare glimpse of two extreme stellar remnants circling each other in quiet cosmic partnership. ✨ #pulsars⚡#binaries⚡#neutronstars⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #450 · 23.10.2025 г., 22:21

🪐 The star AR Scorpii, located about 380 light-years away in the constellation Scorpius, is an unusual binary system where a rapidly spinning white dwarf blasts powerful beams of energy at its red dwarf companion. Unlike typical stars, AR Scorpii pulses in visible light and radio waves every two minutes as its magnetic field accelerates particles, making it the first known "white dwarf pulsar" in our galaxy. ✨ #unusualstars⚡#binaries⚡#pulsars⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #431 · 16.10.2025 г., 12:21

🪐 The star VFTS 352, located in the Tarantula Nebula about 160,000 light-years away, is actually two massive stars orbiting each other so closely that their outer layers touch—creating a rare "overcontact binary." This unusual system is on the verge of merging, and both stars are so hot and bright that their shared atmosphere fuses them together, making VFTS 352 one of the most extreme examples of stellar partnership ever found. ✨ #unusualstars⚡#binaries⚡#TarantulaNebula⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #60 · 02.08.2025 г., 03:11

🪐 The exoplanet Kepler-16b orbits not one, but two stars, forming a real-life counterpart to a Tatooine-like world in the constellation Cygnus. This Saturn-sized planet experiences double sunrises and sunsets as it circles both its orange and red dwarf hosts, creating a celestial theater found nowhere in our own solar system. ✨ #exoplanets⚡#binaries⚡#kepler⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries