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

Резултати

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

Пребарај: #indoeuropean

当前筛选 #indoeuropean清除筛选

On 'Stella Solis' Did you know that the scholiast on Germanicus lists the planet Saturn as 'Stella Solis' - 'Star of the Sun'? Did you know the Babylonians referred to Saturn as '(Mul) Lu-Bat Sag-Uš Mul (il) Šamaš šu-u' - '[the planet] Saturn is the Star of the Sun'? Did you know that in Sanskrit (an #IndoEuropean language) Saturn is called 'Suryaputrah' - 'Son of the Sun'? How can this speck in the sky be referred to as 'star' or 'son of the sun'? It is even smaller than the Sky Father Jupiter. How can weird Caballistic/Christian theories about Saturn being the 'Lord of the (((Chosen People)))' take a hold? I have the answer for you. It will be short, simple and obvious. Coming in an article in a few days. The (((tribe))) is just a bunch of impostors, who obfuscate the real history and re-define it to their advantage! @EuropeanTribalism

On Marduk The Babylonian prime god appeared first in the 3rd millenium B.C. as a Sumerian deity. His serpent-like enemy is Tiamat, the Dragon of Chaos. In order to fight her, he "... grabs a mace, throws lightning before him..." and ultimately vanquishes Tiamat, after chasing her with "... his storm-chariot drawn by four horses." Here we already see a connection to #IndoEuropean roots, as the chariot is a typical symbol.

Just to add one thing: #IndoEuropean|s are around since at least 5.600B.C. In contrast, the Canaanites/Yehudim/Hebrews/(((they))) are around since about 900B.C. - 800B.C. and are, as is their deity, typical children of the Iron (Martian) Age. In order to fix our situation we have to find and reconnect to our true heritage. @EuropeanTribalism

On Christianity Broke: 'Judeo-Christian Occident' Woke: 'Evil Christianity' Bespoke: 'Christians are a joke. Their entire religion revolves around scavenged myths from older times and their doctrine produces only slave brains, which are in fundamental opposition to the Aryan spirit!' The fundamental atrocity of Christianity is the destruction of the Aryan spiritual connection to the divine. The body, the vessel of godlike powers is mutilated to a mere piece of flesh, which only exists to worship and obey a god which is above it. Refuse to be a mental slave! Seek your spiritual roots in the teachings of the #IndoEuropean|s! @EuropeanTribalism

In the Proto-Indo-European language there is no word for king, however there is a word for 'clan chieftain' (wiḱpótis). We could now theorize that #IndoEuropean|s were organized in small groups or clans. Guess where our compatibility with small, manageable tribes comes from!

In the Proto-Indo-European language there are many words for animals and few for fruits, veggies, and grains suggesting a meat-based diet. Combined with the fact that for example the Scythians were nomadic pastoralists makes the Keto diet a peak #IndoEuropean way of nutrition. @EuropeanTribalism

In Proto-Indo-European there is a word for winter/cold (h₂ŕ̥ḱtos). (It also is translated to 'bear'.) It suggest #IndoEuropean|s originated in a more northern climate. Colder climate indicates higher intelligence, as higher temperatures do not benefit a high cognitive performance. @EuropeanTribalism

On the Oseberg Buddha Aboard the 🔗Oseberg Ship there was a little statue, decorated with a cross (pre-Christian time!) and four swastikas positioned with the lotus-seat, known by Asian Buddha statues. We have to connect multiple things here: - swastikas are an Indo-European symbol - the cross is not a Christian symbol - Indo-European lore stretches from India to Scandinavia Who is this statue representing? Thor maybe? In a later article I will elaborate on a possible origin of the swastika, explaining why we Europeans are the bearers of this symbol and why some self-chosen tribe tries to suppress this. #indoeuropean#artifacts @EuropeanTribalism

On Ukko The Finnish Kalevala describes Ukko as an old man, but a powerful one. The legendary character was the god of sky, weather and crops. He could create thunderstorms just by driving his chariot through the clouds. The most significant god in Finnish mythology also had a great weapon: variously described as a hammer, an axe or sword, with which he could create lightning. Ukko was so powerful that a literal thunderstorm took place every time he hooked up with his wife Rauni. Does this sound like an #IndoEuropean archetype, like 🔗Thor to you? #mythology @EuropeanTribalism

On connections I just was reading through some of my old articles and came across 'Scythian Art'. Maybe you want to compare the depiction of the Scythian goddess Apa with the depiction of Kali in this article. There should be no doubt that Apa is based on Kali, the raging hag. In fact we find many female deities who are similar to this Vedic goddess or based on her, like Hathor, Ku-Bao (who derived also from Matar Kubileya), Hera and Astarte. If we give value to this connection, we will be abled to identify the origin of Kali and subsequently all derived goddesses, who are not of the Neolithic fertility archetype, but of Vedic and thus #IndoEuropean origin. #mythology @EuropeanTribalism

ПретходнаСтраница 1 од 3Следна