Один из самых удобных способов записать данные это использование готовых форматов, такие как 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
🖊OPINION | After the US Bombing, a Venezuelan Community Under Siege Speaks
Solidarity activist Roger Harris visited Ciudad Tiuna, where residents described the impact of the January 3 US airstrikes.
Residents say over 100 people were killed in the attack, which also led to the reported abduction of President Nicolás Maduro and Cilia Flores. Community members continue to demand their release, along with sovereignty, non-intervention, and reparations.
Read the full opinion piece here 👉🏾https://venezuelanalysis.com/opinion/after-the-us-bombing-a-venezuelan-community-under-siege-speaks/
#USmilitaryattack
#USVenezuelaRelations
🗒️🗣️ INTERVIEW | What Is Really Happening in Venezuela
Venezuelanalysis editor Ricardo Vaz joined Ileana Chan on the Global Majority for Peace podcast to take stock of Venezuela’s political reality following the January 3 US attacks and kidnapping of President Nicolás Maduro.
The discussion focuses on the long history of imperialist attacks against the Bolivarian Revolution and the US’ efforts to take control of the Venezuelan oil industry.
Watch the full interview here 👉🏾https://venezuelanalysis.com/video/what-is-really-happening-in-venezuela/
#USmilitaryattack#USVenezuelaRelations
🖊OPINION | After the Bombs: Venezuelans Concerned About a Future of Coercion and Colonization
In her latest opinion piece, Jessica Dos Santos takes stock of Venezuelans’ concerns and local expert assessments pointing to a politically and economically difficult road ahead, with the country portrayed as being held hostage by the US, following what officials describe as “a new political moment.”
Read the full opinion piece here: https://shorturl.at/cfU4Z
#USmilitaryattack#USVenezuelaRelations
📰 NEWS | Rubio Defends US Military Operation, Praises Venezuela Oil Reform
US Secretary of State Marco Rubio defended the January 3 US military operation in Venezuela during a Senate hearing, arguing it was not an act of war. He also confirmed that Washington is administering Venezuelan oil sales, with proceeds deposited in US-controlled accounts before partial release to Caracas.
On Tuesday, Acting President Delcy Rodríguez announced that Venezuela is using "unblocked funds" to import medical equipment from the US.
Read our report 👉🏽https://shorturl.at/Sm9iK
#Sanctions#USmilitaryattack#USVenezuelaRelations
📰 NEWS | Venezuela: Judge Refuses to Dismiss Maduro Case, Challenges US Blocking of Defense Funding
A US federal judge has declined to dismiss the case against Venezuelan President Nicolás Maduro and First Lady Cilia Flores during a hearing in Brooklyn.
Judge Alvin Hellerstein rejected defense arguments that sanctions blocking access to Venezuelan state funds justified dropping the charges, but indicated the issue could be revisited. He also challenged prosecutors’ claims, noting sanctions prevent the defendants from using personal funds and stating they “no longer represent a threat.”
Flores’ request for a medical evaluation was approved. Both defendants remain in custody, with a new court date to be scheduled.
Read our full report here 👉🏽https://shorturl.at/jbvKH
#NicolasMaduro#USmilitaryattack#USVenezuelaRelations
📰 NEWS | Venezuelans Stage Mass Rally, Demand Maduro Liberation and Return
Chavista supporters rallied in Caracas on Tuesday demanding the release of President Nicolás Maduro and First Lady Cilia Flores, one month after their reported capture during a US attack on Venezuela on Jan. 3.
Maduro and Flores were arraigned in New York on Jan. 5, pleaded not guilty to charges including drug trafficking conspiracy, and their next hearing has been postponed to March 26 following a request from US prosecutors.
Read the full report here: https://venezuelanalysis.com/news/venezuelans-stage-mass-rally-demand-maduro-liberation-and-return/
#NicolasMaduro#USmilitaryattack#USVenezuelaRelations
📰 NEWS | Venezuelan Healthcare Workers Demand Maduro’s Release as Rodríguez Defends ‘Fearless’ Diplomacy with the US
Venezuelan healthcare workers rallied at UN offices in Caracas on January 23, calling for the release of President Nicolás Maduro and First Lady Cilia Flores after their January 3 detention by US forces. Demonstrators submitted a letter to the UN High Commissioner for Human Rights requesting condemnation of the action and their immediate release.
At the same time, diplomatic engagement between Caracas and Washington is moving forward. Acting President Delcy Rodríguez confirmed ongoing talks with US officials, and the White House announced a prospective visit by the Venezuelan leader.
Read our report 👉🏽https://shorturl.at/CzH4c
#NicolasMaduro#USmilitaryattack#USVenezuelaRelations
🔈PODCAST | Venezuela After January 3: A New Stage of US Imperialism
The VA Podcast is back. In our Season 3 premiere, we tackle the fallout of the January 3rd military escalation against Caracas, an event that marks a volatile new chapter in the long history of US intervention in the region.
Join Venezuelanalysis Chief Editor Ricardo Vaz, Associate Editor Lucas Koerner, and VA Founder Greg Wilpert as they break down the geopolitical shift from "maximum pressure" to direct confrontation. This episode goes beyond the headlines to analyze the underlying causes and the global consequences of Washington’s renewed focus on "its" hemisphere.
Follow the link for early access to this episode: https://www.patreon.com/venanalysis
#USVenezuelaRelations#USmilitaryattack#VAPodcast
🖊OPINION | Western Gangster Journalism Runs Cover for Trump’s ‘Donroe Doctrine’ in Venezuela
Western corporate media have played an active role in recent years in legitimizing escalated US aggression against Venezuela, including whitewashing economic sanctions that killed tens of thousands.
In his latest opinion piece, VA's Ricardo Vaz breaks down this dishonest corporate media coverage that endorsed the US' military buildup and attacks against Venezuela.
Read the full opinion piece here: https://venezuelanalysis.com/opinion/western-gangster-journalism-runs-cover-for-trumps-donroe-doctrine-in-venezuela/
#MediaCoverage#USmilitaryattack
🖊OPINION | Labeling Kidnapping a ‘Capture,’ Media Legitimate Violation of International Law
From January 3–5, leading US newspapers ran 223 articles mentioning Nicolás Maduro. Most described US actions using “capture” or “arrest,” while references to “abduction” or “kidnapping” appeared rarely and only in quoted statements.
On this opinion piece, Greg Shupak exposes the corporate media's work in trying to legitimize the Trump administration's kidnapping of Venezuelan President Nicolás Maduro.
Read the full opinion piece here 👉🏽https://shorturl.at/zyBC0
#MediaCoverage#NicolasMaduro#USmilitaryattack
🎙🔊 Episode 43 of the VA Podcast is live!
The Venezuelanalysis Podcast is back. In our new season premiere, we tackle the fallout of the January 3rd military escalation against Caracas, an event that marks a volatile new chapter in the long history of US intervention in the region.
Join Venezuelanalysis Lead Editor Ricardo Vaz, Associate Editor Lucas Koerner, and VA Founder Greg Wilpert as they break down the geopolitical shift from "maximum pressure" to direct confrontation. This episode goes beyond the headlines to analyze the underlying causes and the global consequences of Washington’s renewed focus on "its" hemisphere.
Watch the full episode here 👉https://youtu.be/NKuCNIxn2MA
#Venezuela#USImperialism#usvenezuelarelations#USmilitaryattack#VAPodcast
📸 IN IMAGES | Venezuelan Gov’t Deploys Social Programs, Cultural Events in Areas Affected by US Strikes
The Venezuelan government has begun a series of cultural and social initiatives in communities impacted by the January 3 US bombings, including La Guaira and Ciudad Tiuna in Caracas. Officials reported damage to housing complexes and announced food distribution, healthcare, and psychological support services for affected families.
During a visit to Ciudad Tiuna, Acting President Delcy Rodríguez also detailed upcoming economic reforms. These include the creation of two sovereign wealth funds, one focused on social protection and another on infrastructure, as well as a proposed reform of the Hydrocarbon Law and additional legislative initiatives.
Click here to explore the full gallery 👉🏽https://shorturl.at/7IfRU
#Culture#DelcyRodríguez#USmilitaryattack