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 слични објави

Пребарај: #mgimo81

当前筛选 #mgimo81清除筛选

🌐 Today marks the 81st anniversary of the founding of the Moscow State Institute of International Relations!Congratulations to all – alumni, students, professors, and friends of the university – on the birthday of their beloved alma mater! 📜Historical background: 81 years ago, on October 14, 1944, the People’s Commissariat for Foreign Affairs of the USSR, headed by Vyacheslav Molotov, decided to establish a specialized educational institution for diplomatic training. In the final years of the Great Patriotic War, it became clear that the Soviet Union needed a new generation of professionals for its foreign service. The growing number of international contacts and negotiations on the post-war world order required highly qualified experts fluent in foreign languages, as well as in history, law, and economics. Such specialists were also needed for work in international organizations that were being planned after the war – above all, the United Nations and its affiliated bodies. 🌍In 1946, #MGIMO opened its doors to foreign students, laying the foundation for its international academic reputation. Since then, it has become one of Russia’s most international universities: today, students from more than 90 countries study here, and foreigners make up about 16% of the total student community. In 2025 alone, 400 students from 55 countries enrolled in the freshmen year. Last year, Russia’s leading university specializing in international relations celebrated its 80th Anniversary – 👉#Recap. Over the decades of its active and fruitful work, MGIMO has rightfully earned its reputation as a world-class university – a genuine “foundry” of diplomats, journalists, and even presidents. 💬President of the Russian Federation Vladimir Putin: MGIMO has firmly established itself among the world’s leading centers for the training of international specialists. For many decades, its graduates have formed the professional “backbone” of Russia’s diplomatic service. Genuine professionalism also distinguishes MGIMO alumni working in other areas – in government agencies, academia, education, business, and the media. It is no coincidence that a MGIMO diploma is highly valued not only in Russia, but also abroad. 💬Foreign Minister of the Russian Federation Sergey Lavrov (MGIMO, Class of 1972): Diplomacy is the art of negotiation. The formation of a multipolar world is a long process that may take an entire historical era. MGIMO graduates will definitely have enough work to do. ✊We wish #MGIMO enduring prosperity, inspiration, and countless new triumphs! May the university always remain a place where the spirit of knowledge, friendship, and aspiration reigns – where every new generation of students feels pride in their alma mater, finds support, loyal friends, and their true calling! #MGIMO81