Один из самых удобных способов записать данные это использование готовых форматов, такие как 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
🆘
⚠️
⚠️
⚠️
⚠️
⚠️
🔔PARTNERSHIP ANNOUNCEMENT
We're pleased to announce our Big Partnership "FFC"
🔠
🔠
🔠
🔠
🔠
🔠
🔠
🔠
🔠
🔠
🔠
🔽We are excited to announce an partnership with #FFC
Force Finance Coin is your gateway to borderless decentralized finance (DeFi). Seamlessly access liquidity pools, yield farming, and secure blockchain transactions in one powerful platform. Designed for scalability, efficiency, and financial freedom.
🚀 Trade. Earn. Grow.
🔗 Start now: forcefinancecoin.com
#ForceFinance#DeFi#CryptoEarning#Blockchain
⏰ Must JoinCrypto Fight Community :
✉️Telegram |
✉️Channel |
📝Twitter |
🔶Binance Live |
*️⃣Linktree
💥If You Want To Promote Your Project Or AMA Proposal
📞DM @Ryan_Fight
In a matter of days, @gazafreedomflotilla and @thousandmadleenstogaza will launch the next wave of civilian ships to Gaza. We sail because world powers enable Israel’s illegal siege. We sail to break it, to expose systems that uphold Israel’s war crimes, and to affirm the rights of the Palestinian people.
Follow the flotilla, share our updates, and never stop amplifying stories from Gaza.
#freedomflotilla#ffc#thousandmadleens#gaza#palestine#breakisraelssiege
@freedomflotillacoalition and @thousandmadleenstogaza are joining forces as one flotilla to challenge Israel’s illegal and inhumane blockade of Gaza.
Our shared mission is rooted in solidarity and justice, standing with the Palestinian people in their struggle for freedom.
Like every past mission, this flotilla is a civil intervention against Israel’s 18-year long illegal blockade on Gaza—which has now been used to manufacture a famine—and a demand for accountability.
We sail because governments and corporations remain complicit in Israel’s occupation, apartheid, and genocide.
All eyes on Palestine 🇵🇸
#freegaza#freepalestine#alleyesongaza#alleyesonpalestine#endtheblockade#freedomflotillacoalition#FFC#thousandmadleenstogaza
Cutting off oil exports to Israel could end their genocidal rampage in Gaza—but U.S. companies like Valero Energy Corporation are still profiting from the slaughter, which is a direct violation of international law, according to legal experts. In addition to our years of sailing to challenge and end the illegal and inhumane Israeli blockade of Gaza, the Freedom Flotilla Coalition is joining with the No Harbour for Genocide campaign. With these and other organisations, we are working collectively to make sure those fuel shipments are blocked and to demand accountability. Boycott companies like Valero, Texaco, Diamond Shamrock, Barclays, Norges, KLP, Nordea, BNP, Axa and many more. Every dollar counts, every supply line disrupted matters. Stand with us to stop Israel's war on Palestinians. Share this video and inform your friends. #NoHarbourForGenocide#BoycottValero#FreePalestine#ValeroEnergy#FreeGaza#WarCrimes#FFC#FreedomFlotilla
The demonstration to release our Flotilla ships currently being prevented from leaving port by the Turkish Port Authorities, continues in Istanbul. We need your help in getting international media to cover this historic protest and help put pressure on the government to release our ships, ensuring we can sail towards Gaza.
HOW TO HELP:
1. Call, email and/or demonstrate at Turkish embassies and consulates and demand that the Freedom Flotilla ships be released and allowed to deliver aid to Gaza immediately.
2. Tag mainstream accounts in this post or when you share our photos to your stories.
3. Message the social media page of the Ministry of Transport and Foreign Affairs @tcdisisleri and @uabakanligi on IG and on X
4. Share our videos using the hashtags #WeWillSail and #LetThemSail tagging @tcdisisleri and @uabakanligi
#WeWillSail#LetThemSail#TheFreedomFlotilla#FFC#Istanbul#Turkiye#Turkey#MaviMarmara
UN experts warned months ago that Israel is deliberately starving Palestinians, and that famine is rapidly spreading across Gaza, and yet Israel continues with impunity and is sent billions of dollars by the US. Children, infants, pregnant women, people living with disabilities, the elderly and those with chronic illnesses are the most at risk of severe malnutrition, illness, and death. Mobilize today, and continue boycotting products and companies that support these war crimes. #freegaza#freepalestine#endtheoccupation#humanitarianaid#costofliving#northgaza#gazacity#freedomflotilla#ffc#breakthesiege#endtheblockade
#BDS
* prices are in US dollars
Our objectives—to break the blockade and raise awareness of the genocide against Palestinians in Gaza—remain unchanged. We will provide updates on our next departure when we are ready to sail again.
In the meantime, we urge you to join the #NoHarbourForGenocide campaign to take action against the siege on Gaza by opposing every country and company complicit in this genocide. #handala#ffc#freedomflotillacoalition#freegaza#freepalestine#endtheoccupation#breakthesiege#endtheblockade#iof#warcrimes#icc#icj
Despite relentless police brutality and state repression in Germany, Yasemin, a Kurdish-Turkish activist on the 'Handala' ship, remains unwavering in her fight for Palestinians. Born into resistance, she fearlessly confronts oppression, transforming each attempt to silence her into fuel to continue fighting for justice. Her steadfast belief in direct action and the power of collective resistance is undeterred by the dangers she has faced, which led her to join 'Handala'. Yasemin encourages all of us watching to disrupt capital and profits in order to create effective change. Download the No Thanks app, search every product before buying it, and boycott companies that support Zionism and Israel’s war crimes against Palestinians. We are never just one person. Together, it is possible to speak their language and hit them where it hurts - their wallets. #endtheoccupation#freegaza#freepalestine#endtheblockade#breakthesiege#freedomflotilla#ffc#yaseminacar#handala#berlin#bds#boycott#divest#sanction
This election is not just about what happens within U.S. borders—it’s about the lives of millions around the globe. When you vote, you’re making a statement about where America stands on human rights. History has shown us that you cannot negotiate with leaders who offer nothing but empty promises. Kamala Harris herself said, "Never let anyone tell you who you are. Show them who you are." Well, the Biden-Harris administration has shown us who they are. For ten months, they’ve done nothing but fund the annihilation of Gaza and the West Bank.
We cannot accept these empty words when hundreds of thousands of lives are at risk. It’s time to demand real action, not just lip service. Sign the petition to enact an arms embargo on Israel, spread the truth in your community, and mobilize for the sake of humanity.
Take Action Now:
🖋️ Sign the Petition: Not Another Bomb! Demand an arms embargo to stop the genocide (in our stories)
📰 Stay Informed: Join the Uncommitted Movement and tell Kamala Harris to stand on the right side of history. Sign up for updates.
🗣️ Spread the Word: Distribute flyers, educate your community, and support candidates who truly stand for human rights.
#KillerKamala#BidenHarris#USElections#DNC#ActForGaza#EndTheOccupation#NoMoreEmptyPromises#FreeGaza#FreePalestine#PermanentCeasefire#UNSecurityCouncil#GlobalImpact#FFC#FreedomFlotilla