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

Резултати

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

Пребарај: #collisions

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

@cosmomyst · Post #303 · 20.09.2025 г., 18:21

🪐 In the spiral galaxy NGC 4438, astronomers have detected a massive black hole mysteriously offset from the galaxy’s center—an unusual finding, since black holes normally anchor the middle of their galaxies. This strange displacement may be the result of a past collision with another galaxy, suggesting black holes can be knocked off-center by cosmic crashes and altering our picture of how galaxies and their hidden giants interact. ✨ #blackholes⚡#galaxies⚡#collisions⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries ​

Universe Mysteries 🪐

@cosmomyst · Post #209 · 02.09.2025 г., 03:11

🪐 The galaxy NGC 4676, known as the "Mice Galaxies," features two spiral galaxies caught in the act of colliding, with long, bright tails of stars and gas stretching far into space. These tails, called tidal tails, form as the galaxies' mutual gravity pulls their outer stars apart, creating a striking and highly unusual shape rarely seen in the cosmos. ✨ #galaxies⚡#collisions⚡#mysteries⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries ​

Universe Mysteries 🪐

@cosmomyst · Post #157 · 19.08.2025 г., 16:11

🪐 In the galaxy ARP 299, astronomers have witnessed a truly strange cosmic phenomenon: two galaxies colliding and triggering a burst of more than a hundred supernova explosions in a single region. This dramatic event releases vast amounts of energy and creates a glowing cloud of hot gas, showing how cosmic crashes can transform entire regions of space in a dazzling display of stellar death and rebirth. ✨ #supernovae⚡#collisions⚡#galaxies⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries

Universe Mysteries 🪐

@cosmomyst · Post #342 · 28.09.2025 г., 15:21

🪐 The galaxy known as the Cartwheel Galaxy, located about 500 million light-years away in the constellation Sculptor, displays a striking ring-and-spoke structure unlike ordinary spirals or ovals. Its unusual shape was created when a smaller galaxy crashed through its center, sending waves of star formation racing outward and leaving behind bright, circular rings and faint, radial arms—an extraordinary cosmic ripple frozen in space. ✨ #galaxies⚡#shapes⚡#collisions⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #749 · 22.04.2026 г., 22:21

🪐 The galaxy Arp 147 shows off one of the universe’s strangest shapes—a bright blue ring of young stars wrapped around a reddish core, formed after a dramatic collision with another galaxy. This kind of "ring galaxy" is extremely rare, created when one galaxy punches through another, sending waves through the gas and sparking new stars to ignite in a perfect circle, making Arp 147 a cosmic example of how galactic crashes can sculpt extraordinary structures. ✨ #galaxies⚡#collisions⚡#rings⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #501 · 16.11.2025 г., 12:21

🪐 The galaxy NGC 922, located about 157 million light-years away in the constellation Fornax, sports a dramatic ring-shaped structure that formed after it collided with a smaller galaxy. This "collisional ring galaxy" features a bright, blue ring of new stars encircling its core, revealing the powerful effects of galactic crashes and creating a cosmic shape rarely found in the universe. ✨ #galaxies⚡#rings⚡#collisions⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #732 · 04.04.2026 г., 22:21

🪐 In 2023, astronomers using gravitational wave observatories detected GW230307, a signal from the merger of two neutron stars in a distant galaxy. Neutron stars are the incredibly dense cores left behind after supernova explosions, and their collision sent ripples—gravitational waves—through space itself, allowing scientists to study the properties of matter squeezed far beyond anything found on Earth. ✨ #gravitationalwaves⚡#neutronstars⚡#collisions⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #618 · 12.01.2026 г., 22:21

🪐 The galaxy ESO 510-G13, located about 150 million light-years away in the Hydra constellation, has a warped, twisted disk that gives it a bizarre, "bent" appearance. Scientists think this unusual shape was caused when ESO 510-G13 merged with a smaller galaxy, distorting its spiral arms and creating a dramatic ripple through its structure—making it one of the most visually striking examples of cosmic collisions turning galaxies into real oddities. ✨ #galaxies⚡#collisions⚡#hydra⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #142 · 16.08.2025 г., 16:11

🪐 In the galaxy NGC 660, astronomers have discovered a rare and bizarre "polar ring"—a huge ring of gas and stars wrapping around the galaxy at a right angle to its main disk. These unusual rings may form after galactic collisions, twisting the cosmic structure into a shape unlike any other in the universe. ✨ #phenomenon⚡#galaxies⚡#collisions⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries

Universe Mysteries 🪐

@cosmomyst · Post #481 · 06.11.2025 г., 12:21

🪐 The galaxy UGC 4881, located about 500 million light-years away, has a remarkable "double-tailed" structure—two long streams of stars and gas extending in opposite directions. This unusual shape was formed when two spiral galaxies collided and merged, creating a cosmic bridge and tidal tails that make UGC 4881 stand out among the universe’s strangest-looking galaxies. ✨ #galaxies⚡#collisions⚡#tidal-tails ⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #569 · 20.12.2025 г., 12:21

🪐 Far out in the Virgo Cluster, astronomers observed a rare cosmic event called an "ultra-compact dwarf galaxy collision," where two tiny, densely packed galaxies like M60-UCD1 have smashed together. The aftermath of such a collision can create ultrabright X-ray sources and disrupt the structure of both galaxies, showing that even small galaxies can undergo dramatic and strange transformations when they collide in deep space. ✨ #cosmicphenomena⚡#collisions⚡#virgo⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​