Один из самых удобных способов записать данные это использование готовых форматов, такие как 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
uShaka Marine World is a popular theme park that opened in 2004 in Durban, KwaZulu-Natal.
The park is divided into four main sections:
• uShaka Sea World – one of the largest aquariums in the world, ranked fifth globally.
• uShaka Wet 'n Wild – a water park with thrilling slides and pools.
• uShaka Beach – a scenic beach area perfect for relaxation and water sports.
• uShaka Village Walk – a lively shopping and dining area with various stores and restaurants.
The aquarium, designed to resemble a shipwreck, is home to dolphins, sharks, seals, penguins, turtles, and many species of fish, some of which are endangered.
Visitors can enjoy spectacular dolphin and seal shows, dive into the aquarium with sharks in a special cage, or snorkel among colorful tropical fish.
For children up to 12 years old, uShaka Kids World offers a massive play area with exciting rides, water slides, a giant sandbox, and creative activity spaces.
🌐Official Website: ushakamarine.com
🎥Video from uShaka Marine World:Watch here.
#tourism#leisure
Diving in South Africa offers unforgettable adventures for everyone!
From exploring the magical kelp forests with playful seals in Cape Town to thrilling close encounters with sharks along KwaZulu-Natal’s subtropical South Coast, every dive is a new discovery. Don’t miss the once-in-a-lifetime experience of the Sardine Run in Sodwana Bay—a true spectacle of nature.
Discover the breathtaking beauty of South Africa both below and above the water.
🎥 Watch the video: Dive into Adventure
#tourism#leisure
Henry, the world's oldest known crocodile, resides at the Crocworld Conservation Centre in Scottburgh, KwaZulu-Natal, South Africa.
Born on December 16, 1900, in Botswana, Henry once gained infamy for preying on local children before being captured in 1903. Now a beloved zoo attraction, Henry has fathered over 10,000 offspring with six mates.
Weighing 700 kilos and measuring 16 feet [4.9 m] in length, Henry's long life and prolific breeding highlight the resilience of Nile crocodiles and the importance of conservation.
Source: Times of India
http://timesofindia.indiatimes.com/articleshow/113071729.cms?utm_source=contentofinterest&utm_medium=text&utm_campaign=cppst
Video: https://t.me/NationGeographic/9647
#nature#leisure
🐒Добро пожаловать в «Манкилэнд» (Monkeyland) – рай для приматов в Южной Африке!🌿
Недалеко от Плеттенберг-Бей, в 500 км к востоку от Кейптауна, находится «Манкилэнд» – первый в мире заповедник, где приматы свободно разгуливают в естественной среде. Здесь обитают спасённые обезьяны со всего мира: капуцины, лемуры, гиббоны и многие другие.
Интересный факт: В «Манкилэнде» находится 128-метровый подвесной мост – самый длинный в мире!
Готовы к захватывающему приключению?
🎥Видео:
#туризм#отдых
___________________
🐒Explore Monkeyland: A Primate Paradise in South Africa! 🌿
Located near Plettenberg Bay, about 500 km east of Cape Town, Monkeyland is the world’s first free-roaming primate sanctuary. Home to rescued monkeys from around the globe, visitors can stroll through a lush forest and spot capuchins, lemurs, and gibbons swinging freely.
Fun fact: Monkeyland has a 128-meter suspension bridge—the longest of its kind in the world!
Ready for a wild adventure?
🎥Video
#tourism#leisure
Вчера мы рассказывали вам о тематическом парке «Морской мир Ушака» (uShaka Marine World). Короткое видео было снято в парке представителем русскоязычной диаспоры ЮАР.
🎥Видео из «Морского мира Ушака».
#туризм#отдых
___________________
Yesterday, we posted about the uShaka Marine World theme park. The short video was made in the park by a member of the Russian-speaking community in South Africa.
🎥Video from uShaka Marine World.
#tourism#leisure
💎«Завтрак у Тиффани»
Завтрак морских котиков в окрестностях Кейптауна. 🦭
#Природа#Туризм#Отдых
___________________
💎 Breakfast at Tiffany’s
Seals are having breakfast not far from Cape Town. 🦭
📹https://t.me/annauar/2469
#Nature#Tourism#Leisure
В часе езды на юг от Кейптауна, в уютном Саймонстауне, находится знаменитый пляж Болдерс (Boulders Beach), где обитает колония очаровательных пингвинов.
Это одно из немногих мест в мире, где можно увидеть африканских пингвинов вблизи в их естественной среде.
📹Видео
#природа#туризм#отдых
___________________
Just an hour’s drive south of Cape Town, in the charming town of Simon’s Town, lies the famous Boulders Beach, home to a colony of adorable penguins.
It’s one of the few places in the world where you can see African penguins up close in their natural habitat.
📹Video
#nature#tourism#leisure
☕️Heaven Coffee Shop at the Cape Town Methodist Church
A small coffee shop inside a large historical church is a unique and atmospheric experience.
You can freely stroll around the hall, play chess, enjoy great coffee with desserts, and take beautiful photos. 📸
🕊Tip: Take your time — the space invites relaxation and admiration of the architecture.
🔗https://t.me/capetown_in_russian/1232
#CapeTown#Coffee#Leisure#Tourism#HeavenCoffeeShop
🖼Boulders Beach — Penguins on the Beach!
🌊 The beautiful Boulders Beach is one of Cape Town’s most visited and the only place in the world where you can get this close to African penguins.
🐧 The Boulders Penguin Colony in Simons Town is home to a unique and endangered land-based colony of African Penguins — one of only a few in the world. This site has become a famous international tourist destination.
The Boulders section of Table Mountain National Park consists of three pristine beaches, one penguin-viewing area, and three wooden boardwalks — built to let visitors admire these wonderful birds while keeping them safe.
Thanks to the huge boulders that shelter the cove from currents, wind, and waves, it’s one of the best spots in Cape Town for both penguins and people. 🌴
🎥 Watch the video: https://www.youtube.com/watch?v=yDiVyXEbiNE
#SouthAfrica#CapeTown#Tourism#Leisure#Nature#Travel#Penguins
В ЮАР существует необычная профессия — наблюдатели за акулами (shark spotters). Их задача — следить за океаном и предупреждать сёрферов и отдыхающих на пляже при появлении акул вблизи побережья. Как именно они выполняют свою работу? Узнайте из видео!
_____________
In South Africa, there is a job called shark spotters. They are supposed to warn surfers and swimmers if a shark is spotted in the distance. How do they do it? Watch the video.
Видео / Video:
https://t.me/prixodite_lyudi_vAfriku_gulyat/2498.
#отдых#пляжи#туризм
#leisure#beaches#tourism
🇿🇦🏔 World’s Longest Zip Line — Just Outside Cape Town!
In 2024, K3 South Africa Forest Adventures launched a 3.2 km zip line — the longest in the world.
It’s located in Caledon, about an hour from Cape Town, with a 500-meter drop and speeds of up to 120 km/h! 💨
📹 Video: https://www.youtube.com/watch?v=Jutf87MXLsE
#SouthAfrica#CapeTown#Tourism#Adventure#Leisure#Extreme#Travel