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

Резултати

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

Пребарај: #mandela

当前筛选 #mandela清除筛选

🕊November 7: The Woman Who Said “No” to Apartheid 🇿🇦🗓 November 7 marks the birthday of Helen Suzman (née Gavronsky; 1917–2009) — a South African activist and politician who bravely stood against apartheid. She was the only member of Parliament to consistently and unequivocally oppose all apartheid legislation. Suzman played a crucial role in improving prison conditions for members of the banned African National Congress (ANC), including Nelson Mandela, and she used her parliamentary privilege to bypass government censorship and share reports on the worst abuses of apartheid. She was nominated twice for the Nobel Peace Prize. 🕊 💬Quotes by Helen Suzman: • “I was the only one who said ‘no’ to apartheid, but that was no reason to keep quiet.” • “It is not my questions that embarrass South Africa—it is your answers.” (Addressed to the apartheid government during her time in Parliament.) • “The test of civilization is the way that it cares for its helpless members.” 📸 Photo: Wikipedia #SouthAfrica#History#HumanRights#AntiApartheid#Mandela

🗓 June 18 – Thabo Mbeki turns 83 On this day in 1942, Thabo Mvuyelwa Mbeki, the second President of South Africa (1999–2008) after Nelson Mandela, was born. As a young man, he studied in the Soviet Union and played a key role in the anti-apartheid movement. 🎓 Mbeki has long emphasized the power of education in transforming Africa. Here are some of his most compelling quotes: 💬 “We must prioritize education and invest in our young people. They are the future leaders and the driving force of our continent's development.” 💬 “Education is the key to unlocking the potential of our people. It’s the tool that will help us overcome challenges and build a brighter future.” 💬 “Education is not just about acquiring knowledge. It’s about developing critical thinking and a lifelong thirst for learning.” #Education#Mbeki#Birthday#SouthAfrica#Mandela

🗓🎉October 7 — Birthday of Archbishop Desmond Tutu (1931–2021) A fearless anti-apartheid activist, theologian, and the first Black South African Anglican bishop, Desmond Tutu received the Nobel Peace Prize in 1984 for his unwavering fight for justice and equality. ✝️✨ 🕊🇿🇦 After South Africa’s first democratic elections in 1994, President Nelson Mandela appointed him to chair the Truth and Reconciliation Commission (TRC) — a crucial step toward national healing after decades of apartheid. 💬Quotes by Desmond Tutu: • “If you want peace, you don’t talk to your friends. You talk to your enemies.” • “Hope is being able to see that there is light despite all of the darkness.” • “Without forgiveness, there is no future.” • “If you are neutral in situations of injustice, you have chosen the side of the oppressor.” • “Children are a wonderful gift. They have an extraordinary capacity to see into the heart of things and to expose sham and humbug for what they are.” #DesmondTutu#SouthAfrica#History#NobelPeacePrize#HumanRights#Mandela

🇿🇦 The Office of the Honorary Consul of South Africa met with Tatyana Mohamed — a Yekaterinburg native who has lived in South Africa for more than 30 years. 🌍✨ 📸 Her husband is a renowned photographer who used to work with Nelson Mandela. During the meeting, we shared insights about the activities of the Honorary Consul, Sergey Mazurkevich, and discussed opportunities for future cooperation and potential joint projects. 🤝 #SouthAfrica#Yekaterinburg#Diplomacy#Cooperation#Culture#Mandela#Photography#HonoraryConsul

NELSON MANDELA STATUE IN PRETORIA 🕊 The nine-meter statue of Nelson Mandela stands on the grounds of the Union Buildings in Pretoria. 🗓 It was officially unveiled on December 16, 2013, one day after the end of South Africa’s 10-day national mourning period, which followed Mandela’s passing on 5 December. 📍 The unveiling took place on Reconciliation Day, a symbolic moment marking a new chapter in the nation’s journey. With outstretched arms, the statue represents unity, reconciliation, and the spirit of Ubuntu — values Mandela championed throughout his life. More on Ubuntu in an upcoming post. #SouthAfrica#Mandela#Pretoria#UnionBuildings#Ubuntu#MandelaLegacy#ReconciliationDay#History#Architecture