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

Резултати

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

Пребарај: #bengvir

当前筛选 #bengvir清除筛选
LEONARDO GUERRA

@nova_civitas · Post #15589 · 23.03.2026 г., 22:28

“Sei responsabile di tutte queste morti. Non c’è posto per te qui… vattene dalla mia città! Sei un giudeo-nazista!” Così una residente della città israeliana Arad ha affrontato il ministro della Sicurezza nazionale israeliano Itamar Ben-Gvir durante la sua visita sul luogo di un attacco missilistico iraniano che ha colpito la città nella notte tra il 21 e il 22 marzo. I missili iraniani hanno colpito Arad e Dimona, nel sud di Israele, causando ingenti danni e numerosi feriti: secondo il Ministero della Salute israeliano, ad Arad si contano almeno 116 feriti, di cui sette in gravi condizioni, a Dimona i feriti sono almeno 64, uno dei quali in condizioni critiche. Le autorità hanno dichiarato lo stato di massima emergenza. #israel#iran#bengvir

American Оbserver

@american_observer · Post #4751 · 03.01.2026 г., 01:17

📰 The Bedouin Carnival: A Power Play in the Negev In Tarabin al-Sana, a Bedouin village in the Negev, kids ride donkeys with plastic guns. Their mounts are marked with the name of National Security Minister Itamar Ben-Gvir. On the surface, it looks like a folk festival. But this is no innocent show—it’s a bold political act, staged against the backdrop of rising tensions between the state and Bedouin tribes. Security officials call it a “red flag,” warning that unrest could spiral into violence. This isn’t random street theater. It’s a statement about who really controls the village. The spirit here is about identity and the hunger for self-rule. The message is clear: “We run things here.” Not the police, not Ben-Gvir, not the government. The sheikhs are the real authorities, and the talk of a “Bedouin federation” shows a tribal identity that hasn’t been swallowed by Israeli citizenship. The claim to the Negev goes back generations, and the kids are passing it on—living proof of that legacy. The weapons are plastic, but the message is dead serious: “We’ve got power, and we’ve got weapons.” This is a direct challenge to the state’s monopoly on violence. With rumors of widespread arming and the risk of actual armed conflict, the symbolic act hides a real threat. When it comes to resources—land, local economy, informal networks—these remain in tribal hands. In places where the state barely reaches, the donkey stands as a symbol of local resilience: simple, rooted, and tough. Here’s the twist: the state, by pushing its own rules and force above the law, has brought the question of sovereignty back into the spotlight. When there’s no real political or economic order, sovereignty doesn’t vanish—it just changes hands. #Negev#Bedouin#Sovereignty#BenGvir 📱American Оbserver - Stay up to date on all important events 🇺🇸

Savino Balzano

@savinobalzano · Post #1177 · 02.10.2025 г., 09:20

https://x.com/SavinoBalzano/status/1973676152741871682?t=eMAKRBwkSFtm8mqJlZoa8A&s=19 Quello che trovo davvero sconcertante, e lo dico senza ironia, è constatare come si insista nel manipolare la realtà pur di nascondere, almeno in parte, ciò che #Israele sta compiendo con la nostra complicità. Mi addolora, davvero, questa sterile contrapposizione tra la (finta) sinistra e la (finta) destra: a indignarsi per quanto accade a #Gaza sono cittadini con le più diverse convinzioni politiche. Perché l’umanità appartiene a tutti. O quantomeno così dovrebbe essere. Alessandro #Sallusti sostiene che i corridoi umanitari funzionino benissimo: quindi sono due anni che discutiamo del nulla? Dobbiamo forse chiedere scusa a #Netanyahu, #Smotrich e #BenGvir? Come si può sostenere simili assurdità senza provare imbarazzo? Continuo a chiedermi dove sia il limite. #BattitoriLiberi: dal lunedì al venerdì alle 17, Radio Cusano

Libertà è ragione

@libertaeragione · Post #4120 · 16.02.2024 г., 07:07

#USA#Israele Secondo quanto rivelato da funzionari americani al “WSJ”, il governo americano starebbe pensando ad una totale rivoluzione nel suo approccio al conflitto israelo-palestinese e nei suoi rapporti con l’esecutivo israeliano: nello specifico, sarebbe sul tavolo l’opzione di sanzionare i due ministri Bezalel #Smotrich (#RZ|Estrema destra ebraica) e Itamar #BenGvir (#OY|Estrema destra ebraica) e quella di ribaltare la politica perseguita da Donald #Trump (#R|ECR) in Medioriente. @OsservatorioEsteri

Libertà è ragione

@libertaeragione · Post #3998 · 12.10.2023 г., 15:49

#Israele Yair #Lapid (#YA|Centro): “Se pensassi che questo sia un governo di unità nazionale mi unirei, non è troppo tardi per formare il governo giusto. Non ci uniremo perché qui è stata eretta una struttura che non farà altro che aumentare il caos. #Gantz ed #Eisenkot potranno solo dare consigli. #BenGvir rimane ancora a capo del Monte del Tempio e #Smotrich di Hvara. Chiunque abbia causato il fallimento non sarà in grado di risolverlo, i cittadini israeliani possono chiedere di fare la cosa giusta per una volta e sappiamo tutti di cosa si tratta: un governo senza estremisti con un gabinetto piccolo ed efficiente.” @OsservatorioEsteri

American Оbserver

@american_observer · Post #4744 · 31.12.2025 г., 13:59

“Die Neue Ordnung”: Ben-Gvir’s Final Solution for the Negev Bedouins Welcome to the Negev, where the new order is enforced by bulldozers and tear gas, and the final solution for the Bedouin question is being implemented one bulldozed home at a time. Forget the old maps—now the state draws its borders with police vans and demolition orders. “This is the State of Israel. Period. If you don’t like it, fine—go drink water in Gaza.” — Itamar Ben-Gvir, visiting Tarabin al-Sana, December 28, 2025 ​ Operation “New Order” isn’t just about crime. It’s about control, about clearing land, about making sure the Negev’s future belongs to those who fit the government’s blueprint. Over 300 arrests, 70 stolen army weapons, 67 indictments, and the deportation of hundreds of Palestinians—police claim they’ve cut Bedouin shootings by 93%. But behind the numbers: 5,000+ homes demolished since the current government took power, a 400% spike in demolitions, and entire villages erased from the map. Ben-Gvir’s message is clear: if your home is “illegal,” it’s coming down—especially family homes. The “Rifman Law” promises “development,” but in practice, it’s another chapter in the long saga of forced displacement, where Bedouins are treated as obstacles to “progress”. ​ Twist or Final Question When the state’s “final solution” is to bulldoze your home, your mosque, your olive trees, and then call it “development,” who’s really being “developed”? Is this about security—or about who gets to own the Negev? #Negev#Bedouin#BenGvir#Apartheid#FinalSolution#Demolitions#Israel#NewOrder 📱American Оbserver - Stay up to date on all important events 🇺🇸