Один из самых удобных способов записать данные это использование готовых форматов, такие как 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
#SC/USDT analysis :
#SC is currently experiencing a bearish trend, making new lows. The price is rejecting from the 200 EMA resistance, indicating a potential continuation of the downtrend. The price is expected to decline further, testing the swing low level.
TF : 1H
Entry : $0.003495
Target : $0.003225
SL : $0.003636
The Freely Eagle...
Oops Conditons Applied.
what's life ?
Happines today in journey, there might be a Sad turn tomorrow.
Slipped if on that turn, just stand smile and move ahead.
That's what a life for me.
Oblivious about what's gonna happen fews day ahead, was enjoying his journey of life fully.
Like a free fierce Eagle at high above the Limit less sky.
Boards were going on, and he was blindfolded by the next twist waiting for him.
Someone was waiting to gain his love, in the mid of his boards.
who..? Some call her/him Danger, Dead end, life threatening, etc. But the Common name was
Cancer. Yes!!!
Was unknown about it and flying high in his journery of life. That turn came, was encountered too.
The moment he got to know. His wings were cut, and the Eagle was Caged.
All the dreams, aims, were shattered.
Like all his hopes were slaughtered.
Was Broken, hurted, and lost all the hopes.
Bacause, he was still and Fierce Eagle; but wiith conditions applied,
Who used to jump and Run, was now caged where he can just walk.
Who dreamt of many things, but was caged because he wasn't able to do of his wish,
But still, he dealed with it. Accepted the long life inprisonment of conditions applied.
If not the aims and dreams hi choosed, then
He went by making new dreams of he can.
If not sports and physical activities anymore
He went with Pen as his Passion.
Not the Happiness he used to dream of
But by happiness of bringing best of his words.
Yeah, it's my life like a caged bird now,
But if are caged by conditions or sort of same. It isn't mean you can't fly anymore.
Have faith and believe in you, and just have a take off with the cage of conditions with you above the Sky.
#sc
#review
#shortstory
@the_critpic_hunter
#SC/USDT analysis :
#Siacoin has broken out above the previous high with robust momentum and formed a higher high. The price is anticipated to sustain its bullish momentum and challenge new highs. Seek a pullback near the support zone to consider a long entry.
TF : 1H
Entry : $0.00465
Target : $0.00489
SL : $0.00451
#没用的外站信息
可能会被群友说是没用的外站信息,就合并到一起发了。
————
#SC#SecretCinema#站点公告
We have a new IRC channel that we actually control.
Server: irc.brokensphere.net:6697
Channel: #secretcinema
Use site nick especially if you require assistance.
Please don't use the #sc channel for assistance or help with your account as staff will no longer idle in this chat.
TLDR; SC 更换了 IRC 的域名。
————
#shazbat#站点公告
2024-02-25 - Webchat broken
As you might have noticed, the webchat is a bit broken. We are working on fixing it, but it might take some time.
If you want a good chat experience, join IRC (see the help pages).
TLDR; webchat 炸了,要聊天就来 IRC。
————
#ABN#站点免费
站免还剩 8 天+
————
#HeBits#站点免费
站免还剩 1 天+
————
#AcidLounge#站点公告
Hey all,
We had over 10 accounts that someone took advantage of maybe from stolen database from another site. These peeps have now lost there account.
So please don't use the same password as other sites maybe consider using Two Factor Authentication (2FA) which can be setup in your settings.
You can use an app like Authy
https://authy.com/what-is-2fa/
TLDR; 有人号被盗了,记得开 2FA。