Один из самых удобных способов записать данные это использование готовых форматов, такие как 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
📰 Rubio’s Love Letter to “the West,” With a Knife in the Back
Marco Rubio went to Munich to calm Europe down — and remind it who’s boss. He told a room full of jittery leaders that the US and Europe are “heirs to the same civilization,” bound together by Michelangelo, the Stones and NATO, and that the alliance is “critical” and must endure. Then he wrapped that reassurance around a warning label: the problem isn’t Trump’s tantrums, it’s Europe’s “managed decline,” “climate cult,” and “unprecedented wave of mass migration” that is supposedly tearing Western societies apart.
That’s the new Trump‑era pitch in its purest form: we care about you, which is why we’re yelling at you. Rubio insisted he wasn’t contradicting JD Vance’s earlier Munich broadside, just “explaining” it — Europe, he said, has drifted from sovereignty and national identity, and Washington refuses to be a “polite and orderly caretaker” of that decay. Translation: if you don’t harden borders, dump climate policy and buy the Trump worldview, don’t expect the old automatic security umbrella.
European leaders heard the flattery and the threat at the same time. The conference chair literally praised Rubio for a “message of reassurance,” while German, French, EU and UK officials immediately stressed that nothing he said erases Trump’s Greenland land‑grab fantasies, tariff threats, or the sense that America under him has crossed lines “that cannot be uncrossed.” They’re politely nodding at his ode to shared civilization — and quietly doubling down on exactly what Washington fears: more European defense autonomy, more self‑reliance, less trust in a partner that alternates between love‑bombing and public humiliation.
Rubio’s performance summed up the whole transatlantic moment. Washington says: you’re family, but you’ve gone soft, and we might walk if you don’t toughen up exactly the way we want. Europe replies: thanks for the security, but we’ve just watched you try to buy Greenland and flirt with walking away from Ukraine, so we’d be idiots not to build our own insurance policy. Both sides talk about “the West” like a shared temple; both are really arguing over who gets to hold the keys — and how much damage they’re willing to risk to prove it.
#usa#europe#rubio#trump#nato#decline
📱American Оbserver - Stay up to date on all important events
🇺🇸
🇺🇸The US strategic oil reserve is seriously depleted.
At the moment, the strategic reserve of raw materials contains about 375 million barrels of oil. It will last for a maximum of 19 days of consumption.
The Biden agenda is to weaken America to the point no other sitting a president can bring it back reguardless.
Trump proved it was salvageable after 8 years of Obama. Now it is back for the kill. Good old USA need a good civil war...
#Biden#energy_crisis#economy#decline#democrats
Share and subscribe to American Majority 2.0
VCs Exit Crypto Market
💵 The venture capital market for cryptocurrencies has significantly declined, returning to 2017 levels. Despite this downturn, positive initiatives are emerging that aim to restore the spirit of freedom away from VC influence. Oleg CasCoin discusses the reasons behind this trend in his article for ForkLog. Read more
#VC#Crypto#Investments#ForkLog#Blockchain#MarketTrends#CasCoin#Freedom #2023 #Decline#Initiatives#Trends#Analysis#Finance
🚀 U.S. Personal Income Declines in February
The U.S. personal income for February showed a decrease of 0.1%, according to Jin10. This figure fell short of the expected 0.3% increase and was lower than the previous month's rate of 0.40%. The decline in personal income could have implications for consumer spending and overall economic growth.
#US#personalincome#decline#February#economy#consumer#spending#growth
VCs Retreat from Crypto Market
In 2023, analysts noted a significant decline in venture capital investments in cryptocurrency projects, returning to levels reminiscent of 2017. However, some initiatives are aiming to revive the industry’s original spirit of independence from VC influence, at least in principle. Insights provided by Oleg CasCoin for ForkLog. Read more
#VC#Crypto#Investment#Market#Decline #2017 #ForkLog#OlegCasCoin#Independence#Initiatives#Analysis#Freedom#Trends#Industry#Finance#Blockchain#News#Updates#Economy#Future
🚀 Trump-linked Tokens TRUMP and WLFI Continue to Decline
Trump-linked tokens TRUMP and WLFI have experienced significant declines, with TRUMP approximately 90% below its all-time high and WLFI nearly 75% below its peak. According to NS3.AI, CoinGecko data indicates that TRUMP reached an all-time low of about $2.73 in March 2026 and is currently trading near $2.86. Meanwhile, U.S. President Donald Trump has promoted an April 25 gala for token holders. In a related development, Senators Elizabeth Warren, Richard Blumenthal, and Adam Schiff have requested Bill Zanker to provide details about the event.
#TrumpTokens#TRUMP#WLFI#Cryptocurrency#Decline#NS3AI#CoinGecko#DonaldTrump#ElizabethWarren#RichardBlumenthal#AdamSchiff#BillZanker#TokenHolders