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

TGINSIGHT SIMILAR POSTS

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

Изворен канал @pythonotes · Post #241 · 5 мај

Можно ли в Python создавать бинарные файлы? Конечно можно. Для этого в Python есть следующие инструменты: ▫️ тип данных bytes и bytearray ▫️ открытие файла в режиме wb (write binary) или rb (read binary) ▫️ модуль struct Про модуль struct поговорим в первую очередь. Файл в формате JSON или Yaml внутри себя содержит разметку данных. Всегда можно определить где список начался а где закончился. Где записана строка а где словарь. То есть формат записи данных содержит в себе элементы разметки данных. В binary-файле данные не имеют визуальной разметки. Это просто байты, записанные один за другим. Правила записи и чтения находятся вне файла. Модуль struct как раз и помогает с организацией данных в таком файле с помощью определения форматов записи для разных частей файла. Модуль struct преобразует Python-объекты в массив байт, готовый к записи в файл и имеющий определённый вид. Для этого всегда следует указывать формат преобразования (или, как оно здесь называется - запаковки). Формат нужен для того, чтобы выделить достаточное количество байт для записи конкретного типа объекта. В последствии с помощью того же формата будет производиться чтение. При этом следует помнить что мы говорим о типах языка С а не Python. Именно формат определяет, что записано в конкретном месте файла, число, строка или что-то еще. Вот какие токены формата у нас есть. Помимо этого, первым символом можно указать порядок байтов. На разных системах одни и те же типы данных могут записываться по-разному, поэтому желательно указать конкретный способ из доступных. Если этого не сделать, то используется символ '@', то есть нативный для текущей системы. В строке формата мы пишем в каком порядке и какие типы собираемся преобразовать в байты. Запакуем в байты простое число, токен "i". >>> import struct >>> struct.pack('=i', 10) b'\n\x00\x00\x00' Теперь несколько float, при этом нужно передавать элементы не массивом а последовательностью аргументов. >>> struct.pack('=fff', 1.0, 2.5, 4.1) b'\x00\x00\x80?\x00\x00 @33\x83@' Вместо нескольких токенов можно просто указать нужное количество элементов перед одним токеном, результат будет тот же. >>> struct.pack('=3f', 1.0, 2.5, 4.1) b'\x00\x00\x80?\x00\x00 @33\x83@' Теперь запакуем разные типы >>> data = struct.pack('=fiQ', 1.0, 4, 100500) я запаковал типы float, int и unsigned long long (очень большой int, на 8 байт) b'\x00\x00\x80?\x04\x00\x00...' Распаковка происходит аналогично, но нужно указать тот же формат, который использовался при запаковке. Результат возвращается всегда в виде кортежа. >>> struct.unpack('=fiQ', data) (1.0, 4, 100500) Как видите, ничего страшного! #lib#basic

Hashtags

Резултати

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

Пребарај: #securitycabinet

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

@american_observer · Post #5087 · 08.02.2026 г., 21:59

📰Israel’s Security Cabinet tightens grip on Judea and Samaria The Israeli security‑cabinet has taken a series of decisions aimed at consolidating Israeli control over Judea and Samaria, effectively rolling back key elements of the post‑Oslo division of powers. For the first time since the Oslo Accords, the Palestinian Authority is to be stripped of its authority in security‑related civil functions in areas “A” and “B,” with those responsibilities transferred to Israel’s Civil Administration. The change is framed as a restoration of law and order, but in practice it marks a formal step toward the reintegration of the West Bank into Israel’s internal administrative system. Civil Administration takes over security‑adjacent rule The Civil Administration will now oversee the enforcement of law and order, water resources, and matters of “heritage” — that is, archaeological sites, historical monuments, relics, and holy places. Religious‑rightwing outlet Israel Hayom notes that the cabinet will also lift the secrecy regime surrounding the land registry in Judea and Samaria, abolish the ban on selling land to non‑Arabs, and scrap the requirement to obtain prior approval from the Civil Administration for land transactions. These moves are explicitly designed to enable Jews to buy land in the territories more freely, reviving a logic of settlement‑driven sovereignty. A Land Acquisition Commission, which previously existed but was later dissolved, will be reestablished, giving institutional backing to this new purchasing‑driven expansion. Hebron and Bethlehem: the anatomy of annexation‑lite The decisions also single out Hebron and Bethlehem for special treatment. In Hebron, the registration of businesses and housing is being shifted from the Palestinian‑municipal framework to the Israeli Civil Administration, and the Jewish quarter is to be carved out into a separate municipal entity — a move that further bifurcates the city into two legal and administrative realities. Similarly, the complex housing the tomb of the matriarch Rachel will be transferred from the Palestinian Authority’s oversight to a dedicated Israeli management body, reinforcing the idea that holy sites linked to the Jewish narrative will fall entirely under Israeli custodianship. The stated logic: water theft, heritage warfare, and lawlessness The government argues that the takeover of water‑infrastructure control is a response to the alleged “theft of water on a massive scale” by Palestinians, and the Palestinian Authority’s indifference to the issue. The transfer of heritage‑related authority, it claims, is necessary because Palestinian actors — with the acquiescence or support of the PA — have systematically damaged archaeological sites that “prove the Jewish people’s connection to the Land of Israel.” From this perspective, the cabinet is not annexing territory in the formal sense, but “reclaiming” what it sees as Jewish sovereignty over land, water, and memory — all under the banner of legality, security, and cultural preservation. The meta‑message: the end of the Oslo zoning game By stripping areas “A” and “B” of their original Oslo‑style representation and handing almost every lever of control to the Civil Administration, the cabinet is effectively admitting that the old formula is dead. The question is no longer whether the PA should have some autonomous role; it is whether there will be any meaningful space left for it at all. So while the language is about “crime,” “water theft,” and “heritage,” the real message to the West Bank is this: the zones of the map are being redrawn, and the map is now drawn from Jerusalem. #Israel#WestBank#JudeaAndSamaria#Hebron#Bethlehem#Settlements#SecurityCabinet#OsloAccords#MiddleEast 📱American Оbserver - Stay up to date on all important events 🇺🇸