Один из самых удобных способов записать данные это использование готовых форматов, такие как 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
Recent travellers to/through Uganda within the past 21 days & are experiencing symptoms associated with #Ebola should call their state ministry of health or 6232 for accurate diagnosis.
DO NOT visit health facilities to avoid the risk of spread through public/private transport.
📢#Ebola Travel Advisory
⛔Avoid all but essential travel to UGANDA
🤒Avoid contact with obviously sick persons/#EVD suspected cases
📞Call 6232 (free of charge) if you have recently returned from Uganda within the past 21 days & feel symptoms of #EVD
🔗
https://ncdc.gov.ng/news/423/public-health-advisory-following-declaration-of-ebola-virus-disease-outbreak-in-uganda
🚨 PUBLIC HEALTH ADVISORY 🚨
The Nigeria Centre for Disease Control and Prevention (NCDC) has announced that Nigeria currently has no confirmed case of Ebola Virus Disease (EVD), following the ongoing outbreak in the Democratic Republic of the Congo and a reported imported case in Uganda.
🦠 Ebola Virus Disease is a severe viral illness transmitted through direct contact with infected bodily fluids or contaminated materials.
Common symptoms include:
✅Fever
✅Headache
✅Weakness
✅Muscle pain
✅Vomiting
✅Diarrhoea
✅severe cases, unexplained bleeding.
The NCDC is actively strengthening surveillance, laboratory readiness, infection prevention, and public awareness efforts across the country. Nigerians are advised to remain calm, maintain good hand hygiene, avoid misinformation, and report unusual illnesses promptly.
Stay informed through official public health channels only. Together, we can strengthen preparedness and protect public health.
#Ebola#PublicHealth#NCDCNigeria#HealthSecurity
Chinese scientists have created a mutant virus by combining a livestock disease with Ebola, resulting in severe symptoms and the death of hamsters. The engineered virus caused systemic diseases and organ failure in the infected hamsters, including impaired vision and scabbing of the eyeballs. The researchers claim their aim was to find safe animal models for studying Ebola symptoms in a lab. If another deadline pandemic emerge, it’s probably from China again.
#Ebola#LabResearch#Biosafety
https://www.dailymail.co.uk/sciencetech/article-13377471/Hamsters-infected-virus-Ebola.html
#Ebola Virus Disease (EVD) has a high fatality rate, but early detection, supportive care, and strict adherence to preventive measures can significantly reduce risks.
⚠️ Protect yourself and others by following health advisories, practicing good hygiene, and reporting any suspected cases immediately.
#EbolaAwareness#HealthyLiving#NCDCNigeria
#Ebola is a serious infectious disease that can spread rapidly if not recognized and contained on time. The signs and symptoms usually appear 2–21 days after exposure.
⚠️ If you or someone around you notices these symptoms, do not ignore them. Seek medical attention immediately and avoid contact with others until cleared by health professionals.
🛡️ Protecting yourself also protects your family, friends, and community.
Let’s work together to stop the spread of Ebola.
#EbolaAwareness#HealthyLiving#StaySafe
#Ebola is caused by the Ebolavirus — a group of viruses with several species, including Zaire, Sudan, Bundibugyo, Taï Forest, and Reston ebolavirus (which affects animals but not humans).
Knowing the cause helps us strengthen prevention and response efforts. 💪🏾
Stay Safe, Stay Protected!
#EbolaAwareness#HealthSecurity#NCDCNigeria
#NCDCUpdate
We have published an #EbolaVirusDisease care kit for incoming travellers from a country with ongoing transmission of #Ebola.
The care kit includes guides to monitor your temperature and symptoms.
Download & share via
https://ncdc.gov.ng/themes/common/docs/protocols/300_1669297182.pdf
#StaySafeStayHealthy
#Ebola doesn’t spread through the air, it spreads through contact!
Avoid direct contact with:
➡️ Blood or body fluids of an infected person
➡️Contaminated objects or medical tools
➡️ Infected animals or bushmeats.
⚠️If you feel unwell after contact, report to a healthcare facility immediately.
Stay alert, Stay safe!
#NCDCNigeria#EbolaPrevention#PublicHealth#StayInformed