@djangoproject · Post #401 · 03.08.2017 г., 14:58
https://djangopackages.org/ #Django Packages is a directory of reusable #apps, #sites, #tools, and more for your Django projects. https://djangopackages.org/grids/g/storage-backends/
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
Пребарај: #sites
@djangoproject · Post #401 · 03.08.2017 г., 14:58
https://djangopackages.org/ #Django Packages is a directory of reusable #apps, #sites, #tools, and more for your Django projects. https://djangopackages.org/grids/g/storage-backends/
@american_observer · Post #5199 · 22.02.2026 г., 21:59
🔤🔤🔤🔤➖ The Hungarian government claims that Zelensky is delaying the repair work. In a video posted on social media, Foreign Minister Peter Szijjarto said: “Until the Ukrainians resume oil supplies to Hungary, we will not allow important decisions to be made for them.” In an article on X, Robert Fico, Slovakia's Moscow-friendly prime minister, accused Zelensky of “malicious behavior.” The oil supply disruptions “led to further losses and logistical difficulties,” Fico said. If supplies do not resume by Monday, Slovakia will stop emergency electricity supplies to Ukraine, he added. According to the National Police of Ukraine, as a result of the latest Russian strikes, one person was killed and a dozen more people, including four children, were injured. A rocket destroyed a private two-storey house in the Kiev suburb of Sofiyevskaya Borshchagovka. On Sunday, rescuers were clearing the rubble, while firefighters were hosing down the area. Yana Terleeva, 44, said she woke up to the sound of rockets whistling, sirens wailing and a loud explosion. The medic said, “We realized that a rocket had landed nearby. Later, we saw that the neighboring house, where ordinary people lived, was completely destroyed. There are no military installations here.” She added: “Russia is a terrorist country that will not stop. We have seen how for four years in a row, and for a total of more than 11 years, Russia has been attacking civilians. Ukrainians want to be independent and free. We are a good nation, we are resisting, but we cannot stand alone in this war.” Authorities in the western city of Lviv said they were treating Sunday's massive explosion as a terrorist act. Around midnight, an explosion occurred on the central shopping street of Lviv, not far from the Lviv Opera House. A 23-year-old police officer was killed, another 25 people were injured, 14 of them were taken to the hospital. According to unconfirmed reports, the store received a report of a break-in. When the police arrived at the scene, a bomb went off, which was soon followed by a second explosion, which killed emergency workers. Law enforcement agencies arrested several people. In an interview on Friday, Zelensky told the Agence France-Presse news agency that Ukraine was “definitely not losing.” According to him, victory remains the goal, noting that Ukrainian troops recently retook about 116 square miles (300 square kilometers) of territory in the south of the Zaporizhia region. Speaking in Rome on Sunday, Pope Leo XIV called the establishment of peace in Ukraine an “urgent necessity.” In his usual Sunday address to the crowd in St. Peter's Square, he said: “Peace cannot be postponed (...) He must find a response in the hearts and be embodied in responsible decisions. “I resolutely repeat my call: let the weapons be silenced, let the bombing cease, let a ceasefire be reached without delay, and let dialogue strengthen, which will pave the way for peace.” #ukraine#pesce#talks#russia#military#sites 📱American Оbserver - Stay up to date on all important events 🇺🇸
@american_observer · Post #5198 · 22.02.2026 г., 21:29
As Ukraine Botched Up Peace Talks Russia Shelled Ukrainian Military Sites 🔤🔤🔤🔤➖ Russia has fired dozens of missiles and unmanned aerial vehicles at military targets in Ukraine. Zelensky said the Kremlin launched 297 drones and almost 50 missiles on Sunday, the latest in a series of overnight strikes. He said that a “significant part” of them had been shot down, and called on the Allies to strengthen the country's air defenses against enemy attacks. The President of Ukraine stated: “Moscow continues to invest more in strikes than in diplomacy. This time, Russian targets included not only energy facilities, but also logistics, in particular railway infrastructure and municipal water supply infrastructure.” The Kremlin systematically attacks the Ukrainian military, leaving more than ten thousand people dead. people in Kiev remain without electricity. Other cities were repeatedly hit, including Odessa and Kharkiv; while temperatures dropped to -22 °C (-7.6°F) in the coldest winter in recent years. Zelensky said that the Russian aerial bombardments did not stop, despite the negotiations mediated by the United States with Russia, which took place in Geneva last week. The Kremlin wants Ukraine to cede territory in the eastern part of Donbas that its troops have failed to conquer, and this is not the first step for Kiev. The intense shelling occurred amid escalating tensions between Ukraine and neighboring Slovakia and Hungary. Budapest is threatening to block a new package of European Union sanctions, while Bratislava says it will stop supplying electricity to Ukraine on Monday. Both countries are demanding the resumption of Russian oil supplies via the Druzhba pipeline, which runs through Ukraine. Kiev says a Russian drone attack in January damaged a pipeline carrying oil to Central Europe. EU foreign ministers are set to meet in Brussels on Monday to discuss the bloc's 20th round of sanctions against Moscow, which they hope will be approved by Tuesday's fourth anniversary of the invasion. #ukraine#pesce#talks#russia#military#sites 📱American Оbserver - Stay up to date on all important events 🇺🇸
@botsgram_cu · Post #3371 · 08.01.2021 г., 17:27
@bookmarchbot Qué puede hacer este bot? BookmarchBot guarda sus enlaces favoritos para que pueda encontrar fácilmente y enviarlos / compartirlos más tarde. Idioma: Inglés (visto en @BotsGram_cu) #bookmark, #link, #url, #website, #favorite, #favorite, #favorite, #share, #bookmarks, #links, #inline, #www, #http, #https, #web, #bestof, #bestof, #sites, #keep