TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #239 · 3 мај

Один из самых удобных способов записать данные это использование готовых форматов, такие как 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

Резултати

Пронајдени 1 слични објави

Пребарај: #bricsoutreach

当前筛选 #bricsoutreach清除筛选

🇷🇺🇲🇳 President of Russia Vladimir Putin and President of Mongolia Ukhnaagiin Khurelsukh held a meeting in Ulaanbaatar. 💬President Putin: First of all, I want to thank you for the invitation. It has, in fact, become a good tradition for us to meet in Mongolia every five years to mark the remarkable highly significant events in our shared history. You have listed the dates we will be commemorating this year. Each of these dates holds special significance for both Russia and Mongolia. I would like to add that Erdenet, which you have mentioned, was planned by architects from Leningrad. I am also pleased to note that the Russian-Mongolian relations have been developing on a new foundation. Our countries have experienced growth in trade, despite the various challenges we have faced, including those you have mentioned, such as COVID. In fact, relations between our countries are progressing well across all areas. Apart from the economy and politics, where we continue to cooperate quite actively, I would like to highlight the successful collaboration in culture and education. The Intergovernmental Commission has been working proactively and there are good results. During our discussions today, we will undoubtedly touch upon the key trends in our economic collaboration. To conclude my opening remarks, I would like to extend an invitation for you to visit Kazan, Russia, where the #BRICS Summit will be held later this year. This will be the first top-level event following the recent expansion of the association. I hope you will take part in the #BRICSOutreach – #BRICSplus format. We look forward to seeing you in Russia. International consultations began with a conversation between the two Leaders in a restricted format, followed by a meeting with the participation of the two countries’ delegations. ✍️ A set of documents was signed following talks. The Government of the Russian Federation and the Government of Mongolia signed agreements on the development of basic project documentation for the reconstruction of the TPP-3 thermal power plant in Ulaanbaatar, as well as on cooperation in the supply of oil products and on providing Mongolia with aviation fuel. The Russian Federal Service for the Oversight of Consumer Protection and Welfare and the Ministry of Health of Mongolia signed an Agreement on cooperation to ensure epidemiological welfare with regard to plague. In addition, the Russian Federation Ministry of Natural Resources and Environment and the Ministry of Environment and Climate Change of Mongolia signed a Memorandum of Understanding on cooperation in the conservation of Lake Baikal and the Selenga River. Presidents Vladimir Putin and Ukhnaagiin Khurelsukh also made statements to the media. #RussiaMongolia