Один из самых удобных способов записать данные это использование готовых форматов, такие как 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
#Announcement
🎙 On Thursday, May 7, Russia’s Foreign Ministry Spokeswoman Maria Zakharova will hold her weekly briefing on current foreign policy issues.
🕙 10.00 am MSK
🕖 7.00 am GMT
🕗 8.00 am CET
🕒 3.00 pm CST
For accreditation inquiries, please contact the MFA Press Centre. Accredited journalists will receive details on the technical aspects of submitting questions.
The Foreign Ministry Spokeswoman will answer media questions received by the call centre.
❗️Accreditation is open until May 5, 10:00 am MSK
#Announcement
🎙 On Wednesday, April 29, Russia’s Foreign Ministry Spokeswoman Maria Zakharova will hold her weekly briefing on current foreign policy issues.
🕐 1:00 pm MSK
🕙 10:00 am GMT
🕚 11:00 am CET
🕕 6:00 pm CST
For accreditation inquiries, please contact the MFA Press Centre. Accredited journalists will receive details on the technical aspects of submitting questions.
The Foreign Ministry Spokeswoman will answer media questions received by the call centre.
❗️Accreditation is open until April 28, 10:00 am MSK
#Announcement
💐 As the 81st anniversary of Victory Day approaches, marking the end of the Great Patriotic War of 1941–1945 within the wider context of the Second World War, it offers a moment for quiet reflection. The courage and sacrifice of Soviet citizens and Allied nations brought one of humanity’s most devastating conflicts to a close.
One initiative associated with this commemorative date is the Immortal Regiment, established to honour those who experienced that wartime period. In support of this effort, activists from the Russian-speaking community have recently launched a digital platform, moypolk.uk, dedicated to preserving the legacy of all Second World War veterans.
It recognises both Soviet soldiers, whose descendants now live in the United Kingdom, and British servicemen and women who fought bravely against fascism. The archive already includes records of more than 900 veterans.
Members of the public are invited to contribute by sharing family histories, photographs, and details of wartime service. The platform also offers the option to take part in the Immortal Regiment march online.
Find out more
#Announcement
🎙 On Friday, April 24, Russia’s Foreign Ministry Spokeswoman Maria Zakharova will hold her weekly briefing on current foreign policy issues. The off-site briefing will be held in a hybrid format in Izhevsk, Udmurt Republic.
🕚 11.00 am MSK
🕗 8.00 am GMT
🕘 9.00 am CET
🕓 4.00 pm CST
For accreditation inquiries, please contact the MFA Press Centre. Accredited journalists will receive details on the technical aspects of submitting questions.
The Foreign Ministry Spokeswoman will answer media questions received by the call centre.
❗️Accreditation is open until April 22, 15:00 pm MSK
#Announcement
🗓On April 17, the first meeting of the CIS Council of Foreign Ministers in 2026 will be held in Moscow. Russia will be represented by Foreign Minister Sergey Lavrov.
The Foreign Ministers of the Commonwealth countries will review the results of inter-ministerial cooperation in 2025 and discuss prospects and key objectives for advancing integration ties, including in the context of implementing the priorities of Turkmenistan’s current chairmanship of the Organization and the 35th anniversary of the CIS, which is being marked in 2026.
An exchange of views is also expected on pressing international and regional issues.
📃 The meeting is expected to adopt a number of decisions aimed at strengthening foreign policy coordination and cooperation in the cultural, humanitarian, law-enforcement and other spheres.
#Announcement
🎙 On Thursday, April 16, Russia’s Foreign Ministry Spokeswoman Maria Zakharova will hold her weekly briefing on current foreign policy issues.
🕒 3:00 pm MSK
🕛 12:00 pm GMT
🕐 1:00 pm CET
🕗 8:00 pm CST
For accreditation inquiries, please contact the MFA Press Centre. Accredited journalists will receive details on the technical aspects of submitting questions.
The Foreign Ministry Spokeswoman will answer media questions received by the call centre.
❗️Accreditation is open until April 14, 12:00 pm MSK
#Announcement
🎙 On Wednesday, April 8, Russia’s Foreign Ministry Spokeswoman Maria Zakharova will hold her weekly briefing on current foreign policy issues.
🕐 1:00 pm MSK
🕙 10:00 am GMT
🕚 11:00 am CET
🕕 6:00 pm CST
For accreditation inquiries, please contact the MFA Press Centre. Accredited journalists will receive details on the technical aspects of submitting questions.
The Foreign Ministry Spokeswoman will answer media questions received by the call centre.
❗️Accreditation is open until April 7, 10:00 am MSK
#Announcement
🎙 On Wednesday, April 1, Russia’s Foreign Ministry Spokeswoman Maria Zakharova will hold her weekly briefing on current foreign policy issues.
🕛 12:00 pm MSK
🕘 9:00 am GMT
🕙 10:00 am CET
🕔 5:00 pm CST
For accreditation inquiries, please contact the MFA Press Centre. Accredited journalists will receive details on the technical aspects of submitting questions.
The Foreign Ministry Spokeswoman will answer media questions received by the call centre.
❗️Accreditation is open until March 31, 10:00 am MSK
#Announcement
🎙 On Wednesday, March 25, Russia’s Foreign Ministry Spokeswoman Maria Zakharova will hold her weekly briefing on current foreign policy issues.
🕐 1:00 pm MSK
🕙 10:00 am GMT
🕚 11:00 am CET
🕕 6:00 pm CST
For accreditation inquiries, please contact the MFA Press Centre. Accredited journalists will receive details on the technical aspects of submitting questions.
The Foreign Ministry Spokeswoman will answer media questions received by the call centre.
❗️Accreditation is open until March 24, 10:00 am MSK
#Announcement
🎙 On Wednesday, March 18, Russia’s Foreign Ministry Spokeswoman Maria Zakharova will hold her weekly briefing on current foreign policy issues.
🕐 1:00 pm MSK
🕙 10:00 am GMT
🕚 11:00 am CET
🕕 6:00 pm CST
For accreditation inquiries, please contact the MFA Press Centre. Accredited journalists will receive details on the technical aspects of submitting questions.
The Foreign Ministry Spokeswoman will answer media questions received by the call centre.
❗️Accreditation is open until March 17, 10:00 am MSK
#Announcement
🗓The International Security Forum held under the auspices of the Security Council of the Russian Federation is scheduled to take place on May 26-29, 2026, at the ‘Live Arena’ multifunctional complex and the ‘Patriot’ Central Park.
The Forum to feature the following events:
• the XIV International Meeting of High-Ranking Officials Responsible for Security Matters
• a variety of thematic sessions (scientific conferences, roundtables, briefings, presentations)
• bilateral and multilateral meetings
• exhibitions devoted to specific areas of activity of relevant Russian agencies and organizations
👉The Forum's Core Events (.doc file)
More than 180 delegations from foreign states and international organizations have been invited to participate in the Forum.
Secretaries of security councils, national security advisors to heads of state, directors of law enforcement agencies and special services, and general secretaries of international organizations are expected to attend. Ambassadors of foreign states, representatives of the academia, and security experts will also participate in the event.
👉Russian government agencies and ministries, organizations and companies featured at the Forum
Total number of participants is expected to be as high as 5,000 people.
Forum's working languages: Russian, Arabic, Chinese, English, Farsi, French, Serbian, and Spanish (simultaneous interpretation will be provided).
👉Accreditation & registration for the Forum's participants (starts on March 17)
👉Accreditation for media representatives
#Announcement
🎙 On Thursday, March 12, Russia’s Foreign Ministry Spokeswoman Maria Zakharova will hold her weekly briefing on current foreign policy issues.
🕙 13:30 am MSK
🕗 10:30 am GMT
🕘 12:00 pm CET
🕓 7:00 pm CST
For accreditation inquiries, please contact the MFA Press Centre. Accredited journalists will receive details on the technical aspects of submitting questions.
The Foreign Ministry Spokeswoman will answer media questions received by the call centre.
❗️Accreditation is open until March 11, 9.00 am MSK