Один из самых удобных способов записать данные это использование готовых форматов, такие как JSON или YAML.
Из плюсов такого подхода стоит отметить вот что:
🔸 готовый, повсеместно используемый и поддерживаемый формат
🔸 простой и понятный файл, удобочитаемый для человека
🔸 можно легко редактировать в любом текстовом редакторе без специальных программ и библиотек
Но есть и минусы
🔹 затраты времени при записи файла (кодирование данных в нужный формат строки)
🔹 затраты времени при чтении файла (декодирование данных в Python объекты)
🔹 размер файла увеличивается из-за разметки данных (скобки, запятые, переносы, отступы...)
🔹 перед записью все данные должны быть помещены в память в полном объёме (не всегда)
🔹 при чтении необходимо считать весь файл в память и только потом декодировать данные
Если нужно писать немного данных в несколько файлов, то затраты по времени не ощутимы. Обычно это файлы конфига или какие-либо метаданные. Это отличный вариант под такие задачи.
Есть и другой поход к записи файлов - это бинарные файлы. Используется, когда данных достаточно много и никто их не собирается читать глазками😳.
🔸 очень быстрая запись
🔸 чтение значительно быстрей чем JSON, YAML итд
🔸 размер файла значительно меньше, так как нет разметки
🔸 можно записывать данные по мере поступления не загружая всё в память
🔸 можно извлечь любую часть данных независимо
Из минусов
🔹 нужно определить свой формат записи данных (если не используете готовую спецификацию определённого формата)
🔹 не получится открыть файл и визуально понять что там записано, а для чтения файла потребуется знать его спецификацию.
🔹 не так-то просто создать такой файл без специальной библиотеки
В таком виде удобно записывать большой массив любых однородных данных. Например, мониторинг валютной биржи или кэшированная анимация 3D геометрии.
(Это не означает что нельзя записать данные разного типа, просто это будет не так удобно)
Представьте себе JPG-картинку. По сути это немного мета-информации и большой массив пикселей. Тоже самое со звуком или видео файлом. Поэтому, если вы попробуете открыть картинку в текстовом редакторе вы увидите что-то вроде такого
f15d cd29 a564 4578 ...
09e2 9bc4 a696 1253 ...
84e9 4de1 3b23 c24a ...
2534 5161 28e0 709d ...
...
Это и есть записанные байтики. И для их чтения требуется определённый софт который знает что с ними делать. Под каждый тип файла.
К чему это я? Читайте в следующем посте...
#tricks#basic
Nullité des services français.
Les familles de tous les prisonniers du bateau #Madleen reçoivent des nouvelles de leur service consulaire national. Sauf les Français. Nos familles n'ont aucune nouvelle alors que la rétention illégale dure depuis près de 24h. Nous Insoumis sommes sans nouvelle aussi.
Malgré nos relances au plus haut niveau, on ne sait même pas où sont les détenus.
Les services français ont-ils seulement demandé à être mis en contact ? Comment dire l'ecoeurement que cela nous inspire ? Comment notre pays peut-il s'abaisser ainsi ? Pourquoi les citoyens français sont-ils traités comme ça par les dirigeants du pays ?
👉Partagez sur Twitter
-----------
On vous a transféré ce message ? Abonnez-vous au canal Telegram de Jean-Luc Mélenchon sur : https://t.me/JLMelenchon
Rumbo a Gaza
🇵🇸 | 12 voluntarios de todo el mundo que navegan en el #Madleen. Una misión para romper el asedio ilegal de Israel a Gaza y establecer un corredor marítimo popular. #FreedomFlotillaCoalition
Vía 📱@PiensaPrensa
Síguenos t.me/Epinforma🔁 comparte
Some snippets from Greta’s interview after being deported by Israeli authorities. Continue fighting for Palestinians in Gaza, including those in wider Palestine who are unlawfully imprisoned, including over 400 children.
#Madleen#IOF#GretaThunberg#FreedomFlotilla
Palestinians in Gaza are being starved, denied aid, genocided- and this is all on live stream and on our watch. A statement from Yasemin Acar, FFC volunteer on ‘Madleen’ who was kidnapped by IOF, forcibly taken to Israel and currently being held in detention is delivered by her brother J. Acar. This is the real story.
#FreeGaza#BreakTheSiege
#Madleen#EndTheGenocide
Our 'Madleen' was on a mission of urgency after a year of set backs, carrying baby formula, food, medicine, and basic humanity. Then came unidentified vessels, speedboats, quadcopters, and finally, Israeli soldiers. Francesca Albanese recounts what happened in real-time as she spoke to the crew live. She reminds us that 'Madleen' was a UK-flagged boat seized in international waters. Israel's interception is an act of piracy. Abduction is illegal, as is their siege, genocide, occupation and countless other war crimes across Palestine. So what makes a small, aid boat so scary for the Israeli occupation? According to Francesca Albanese: it is our humanity. It is everyone's defiance. It is our collective power to break the siege.
#BreakIsraelsSiege#EndTheBlockade#StandWithGaza#FrancescaAlbanese#Madleen
The Freedom Flotilla Coalition invites you to join us from May 30th to June 1st in Catania, Sicily, Italy, as we stand together in solidarity to launch our new mission, the ‘Madleen’.
The summit will be happening in Porto di San Giovanni li Cuti, where we will stand in solidarity with the Palestinian people in a series of panels, cultural programs, and community gatherings.
The ‘Madleen‘ will sail to break Israel's illegal siege as we bring humanitarian aid, hope, and solidarity to Gaza. The world stands united against the deliberate starvation, genocide, Apartheid, colonial occupation, and the ethnic cleansing of the Palestinian people. Join us!
Let's sail in spirit and solidarity. Free Palestine!
#FreedomFlotilla#BreakIsraelsSiege#EndTheBlockade#StandWithGaza#AllEyesOnDeck#Madleen#Conscience
Meet just some of the panelists, volunteers and supporters that will join us as we launch the ‘Madleen’ that will sail in a matter of days to break Israel's illegal siege of Gaza.
We urge media, press and supporters to join us in Catania, Sicily - your coverage and solidarity is critical in helping ensure our safety. March with us. Make noise with us. Show the world that Europe will not be silent. Share our content. Make it impossible for every politician, for the European Union and media to ignore what is happening in Gaza. Make it impossible for them to ignore the voice of the people, to ignore this mission, and to ignore this moment.
#BreakTheSiege#BreakIsraelsSiege#AllEyesOnDeck#EndTheBlockade#StandWithGaza#AllEyesOnDeck#Madleen#Conscience
Lara, speaking from Brazil, has had no contact with her husband, Thiago Ávila, since he was abducted and detained illegally by Israeli forces from the 'Madleen'. Since then, Thiago has been placed in solitary confinement, denied communication with his family.
According to Lara, Israeli authorities threatened Thiago with the psychological torment of isolation without light or ventilation. Despite this, Thiago remains on hunger strike, holding firm to his belief in justice for Palestinians and the right of every child to food, safety, and freedom.
From his prison cell, he wrote a letter to his 1-year-old daughter. Lara generously shares that with us today.
This is a call not just for Thiago’s release—but for the world to pay attention to Gaza, to Palestine, and to all people who are exploited, forced to live under occupation.
#FreedomFlotilla#Madleen#Thiago#IOF#WeWillSail#BreakIsraelsSiege#EndTheBlockade
Now with Israel's attack on Iran, the airports are shut down, and our three remaining 'Madleen' team members, Pascal Maurieras, Yanis Mhamdi, and Marco van Rennes may face an extra month, illegally detained in Israeli prison.
All three were meant to be released and flying back to their families today, June 13. The French and Dutch governments must find alternative routes and get their citizens home, whether through Jordan or otherwise - NOW.
Contact details in our slides and email template in our stories.
#BreakIsraelsSiege#EndTheBlockade#Madleen#WeWillSail#AllEyesOnDeck#StandWithMadleen#StandWithPalestine
Meet the 12 volunteers from around the world, who are sailing on 'Madleen' in the Freedom Flotilla Coalition's steadfast mission to break Israel's illegal siege of Gaza and establish a people's sea corridor:
Baptiste Andre 🇫🇷
Greta Thunberg 🇸🇪
Şuayb Ordu 🇹🇷
Mark van Rennes 🇳🇱
Omar Faiad 🇫🇷
Pascal Maurieras 🇫🇷
Reva Viard 🇫🇷
Rima Hassan 🇫🇷
Sergio Toribio 🇪🇸
Thiago Ávila 🇧🇷
Yanis Mhamdi 🇫🇷
Yasemin Acar 🇩🇪
Let their names be known, as they hold the people's hearts and courage, and carry solidarity to Palestinians in Gaza.
#AllEyesOnDeck#Madleen#Conscience#BreakTheSiege#EndOccupation#FreePalestine#FreedomFlotilla
The seizure, detention, and attempted deportation of the our team are clear violations of international law and Israeli law. They must be released immediately and unconditionally. We will not be silent. The blockade is illegal. Our mission remains: to break the siege and deliver aid to Gaza.
Artwork by Zina Zindah, 11 years old, during an art workshop by @maysaartist from Gaza.
#FreedomFlotilla#EndTheBlockade#Gaza#HumanRights#LetThemGo#Madleen#WeWillSail
Freedom Flotilla Official Update: It's time for our governments to do their jobs and sanction Israel. Its illegal attack on 'Madleen' while sailing in international waters is a small extension of their war crimes in Gaza. Governments, institutions, media, and corporations must stop protecting Israel, now. They must stop prioritising profit over human lives, now. Protect our volunteers while protecting Palestinians in Gaza and wider Palestine.
#BreakIsraelsSiege#EndTheBlockade#Madleen#FreedomFlotilla#Volunteers#IOF#StandWithGaza#StandWithPalestine