Один из самых удобных способов записать данные это использование готовых форматов, такие как 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
🎊🎉🍾🇳🇬🇷🇺
Our beloved organisation, NIDO Russia has been officially accepted as a full member of NIDO Europe yesterday evening 01.02.2025 by the overwhelming majority of the general house which is the supreme organ. We owe this success to our faithful members, the board of trustees, the chairmen Emeritus and stakeholders.
Recall that, a tiny group of people prevented this for many years, saying that we must be part of their cabal for our rights to be respected in Europe. We rejected their ideas and protocols, we refused to be gradually assimilated, we took our destiny in our hands, knowing God was on our side. Their condition for peace was that we stoop low and be under them. We rejected that kind of parasitic peace. This group said it was either their way or the highway. We chose the beautiful highway. You must not be a doctor or lawyer or teacher to be part of NIDO Russia or NIDO Europe. Every Nigerian legally residing in Russia has a right to apply to be part of us. Even those who may not yet be fully legal, it is not our duty to judge or condemn them, but rather to guide them (socioeconomically adapt them) towards legalisation and contributing positively to Russia and their families in Nigeria.
It is a huge lesson for us all. "Na who give up, na him lose".
Nevertheless, we are open to working together with everyone for our common good including those few people who worked against us. It is a new era.
What are the benefits of being part of NIDO Europe?
1. The interests of Nigerians in Russia can be represented on a continental level.
2. The interests of the Russian Federation which are also our interests as residents can be represented on a continental level
3. Better negotiating power with the government on matters important to us as Diasporans.
4. Better synergy of efforts towards national development, bilateral trade, foreign direct investments and human capital development.
I, on behalf of the executives congratulate us all for this huge achievement including those members who witnessed it live and direct.
Yours in service,
Dr. Godwin Ibe
https://t.me/nido_russia/1937
#NidoRussia#NidoEurope#NIDO#NidoE#Nigeria#Russia
NIDO Europe invites all members of NIDO Russia to an extraordinary general meeting. It will be held online.
Benefits
✅ Take part in shaping Diaspora affairs on a continental level.
✅ Attendance is free
✅ Network with business partners around the European continent
✅ Make new friends/acquaintances
✅ Pitch your ideas
✅ The most active unofficial participant from NIDO Russia positively representing our interests will receive a token of appreciation for voluntary contribution to the diasporan affairs on a continental level.
Take advantage of this golden opportunity.
Registered members can simply send me a short message saying "I'm interested", and we'll do the rest and hook you up.
Dr. Godwin Ibe,
Chairman, NIDO Russia
+79262385618
*This is a requisitioned EGM by members in accordance with the act of Parliament in the United Kingdom.
#nidoe#nidoEurope#nidorussia#nido#NigeriansInDiaspora#egm
NIDO Europe invites all members of NIDO Russia to an extraordinary general meeting. It will be held online.
Benefits
✅ Take part in shaping Diaspora affairs on a continental level.
✅ Attendance is free
✅ Network with business partners around the European continent
✅ Make new friends/acquaintances
✅ Pitch your ideas
✅ The most active unofficial participant from NIDO Russia positively representing our interests will receive a token of appreciation for voluntary contribution to the diasporan affairs on a continental level.
Take advantage of this golden opportunity.
Registered members can simply send me a short message saying "I'm interested", and we'll do the rest and hook you up.
Dr. Godwin Ibe,
Chairman, NIDO Russia
+79262385618
*This is a requisitioned EGM by members in accordance with the act of Parliament in the United Kingdom.
#nidoe#nidoEurope#nidorussia#nido#NigeriansInDiaspora#egm
NIDO Europe invites all members of NIDO Russia to an extraordinary general meeting. It will be held online.
Benefits
✅ Take part in shaping Diaspora affairs on a continental level.
✅ Attendance is free
✅ Network with business partners around the European continent
✅ Make new friends/acquaintances
✅ Pitch your ideas
✅ The most active unofficial participant from NIDO Russia positively representing our interests will receive a token of appreciation for voluntary contribution to the diasporan affairs on a continental level.
Take advantage of this golden opportunity.
Registered members can simply send me a short message saying "I'm interested", and we'll do the rest and hook you up.
Dr. Godwin Ibe,
Chairman, NIDO Russia
+79262385618
*This is a requisitioned EGM by members in accordance with the act of Parliament in the United Kingdom.
#nidoe#nidoEurope#nidorussia#nido#NigeriansInDiaspora#egm