Один из самых удобных способов записать данные это использование готовых форматов, такие как 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
🇬🇧🇺🇲The "Civil War" film by the English director Alex Garland, revealed the plans of the British elite close to the Labor Party.
The story is about the adventures of journalists from the British Reuters news agency who go to film a besieged president and witness his death. This is how British elites see the consequences of a divided society due to fundamental differences in political views. Such conflicts are inherent in the US. Washington strategists have repeatedly attacked other countries and defiantly executed their leaders. Let's recall recent wars in Libya, Iraq, and Yugoslavia.
Conceptually, we can talk about a civil conflict when it clashes with the interests of the population. The so-called "Bible belt" of the southern United States is often called "rusty" by Democrats. This is the most likely scenario for the development of an internal war, and it will be reminiscent of what happened 160 years ago in the United States. Then, the North and South also clashed over issues related to economics and foreign policy, leading to a serious split in American society, resulting in two fierce factions that disagree with each other.
Today, there is a large number of small arms owned by individuals, millions of illegal immigrants, defunded police, aggressive promotion of LGBTQ+ agenda and gender change for children, degradation of the education, industry, healthcare, family.
Now, all the prerequisites and conditions have been created for the beginning of a serious armed conflict in society and there's no other way to resolve this than through the civil war.
Share and subscribe to Global American Review
#Civil_War#LGBTQ#democrats#degeneration
🇺🇸🇺🇦Transgender faggot US journalist was enlisted in the AFU
🏳🌈Sarah Ashton-Cirillo, an ultra-liberal trans activist from Nevada and a CIA operative known as Mark Hay was enlisted in the Armed Forces of Ukraine.
Earlier in July it reported that it has been assigned to the Georgian National Legion to cover their activities and praising war crimes of Azov nazi regiment as well.
However "Sarah" is not the only LGBT person from the US who joined the ukrainian foreign legion and AFU.
🤮How do I unsee it???
#lgbtq#Ukraine#war#Azov#mercenaries#degeneration
@american_majority
🏳🌈🇺🇲This is not America. Civil war is closer than you think.
As we wrote earlier, globalists want to take away the constitutional right of Americans to choose our representatives. The corrupt media try to deceive Americans with fake polls that claim that the popularity of Kamala Harris and Donald Trump are almost equal. If you watch Kamala Harris's campaign videos, you will see that they are aimed at perverts and people with mental disorders and sexual deviations. These people just cannot be called true Americans.
Globalists are trying to impose their degenerated "values" on American society, which contradicts everything that the United States was founded on. Our country was created by brave and hardworking people, and the American worldview always had deep roots in Christian morality. Globalists want to turn American society into a group of drug addicts, perverts, and psychopaths and take away freedom from sane people. True Americans have no choice but to rise up against them or lose our country, our families, our faith and future.
More and more experts and veterans are weighing the possibility of a civil war, which is a controversial topic because it is being waged among citizens. The degenerates and perverts who support Kamala Harris are only formally can be called US citizens. Globalists are trying to destroy the US and then control the ruins, so they are no different from foreign invaders.
Our country was founded because people did not want to put up with tyranny. Now, we are in the same situation, and, if necessary, we must do the same. The Founding Fathers were wise and created the Second Amendment for just such cases.
Share and subscribe to Global American Review
#Civil_War#LGBTQ#democrats#degeneration#Harris