Один из самых удобных способов записать данные это использование готовых форматов, такие как 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
On this #WorldFoodDay, let's prioritize nutritious, balanced meals and make healthier food choices for a stronger, disease-free future.
Good nutrition is the foundation of good health. 💪
#HealthyEating#WorldFoodDay#NCDCNigeria
Healthy Planet, Healthy You!
❗️Informative signs on “General Rules and Environmental Protection: Healthy Eating Habits” have been placed around the campus by psychologist Muslima Nabijonova and tutor Shokhrukh Obidov — reminding everyone that caring for nature starts with caring for ourselves
#GreenUniversity#EcoLifestyle#HealthyEating#Sustainability
✉️[email protected]
☎️ +998 55 512 00 77
📍Location
🌐Website | 📱Telegram | 📱Instagram | 📱LinkedIn | 🟥YouTube
Black sapote is a fruit from Mexico and Central America. When unripe, it is hard and green. When ripe, the skin is olive-green, and the inside is soft, dark brown, and creamy like chocolate pudding. It tastes sweet and mild, like chocolate but has no bitterness or caffeine. People eat it as dessert or use it in smoothies and baking. 🍫🍃
[Source]
@googlefactss#BlackSapote#TropicalFruit#HealthyEating
Pink Pasta
🍝 Ingredients:
- 300 g pasta
🍄Sauce:
- 250 g cooked beetroot 🥗
- 100 g cashew nuts 🥜
- 50 ml water 💧
- 1 tbsp soy yogurt skyr 🥛
- 1 tsp oil 🫒
- 1 tsp agave syrup 🍯
- 1 tsp salt 🧂
- 1 tsp pepper 🌶️
- 1 tsp vegetable broth 🍲
Preparation:
1. 🥄 Soak the cashews in warm water for 10 minutes, then drain. Meanwhile, cook the pasta 🍲.
2. 🥢 Dice the beetroot and blend it with the other sauce ingredients until smooth.
3. 🍳 Crumble the tofu and sauté in oil, then add the beetroot and chickpeas. Fry until golden.
4. 🍝 Mix the pasta with the sauce, add your favorite toppings, and enjoy!
#PinkPasta#VeganRecipe#HealthyEating
@dishes
High Protein Wan Tan
Ingredients:
For the dough:
- 250 g flour 🌾
- 1 tsp salt 🧂
- 100 ml warm water 💧
For the filling:
- 1 cm ginger 🫚
- 100 g soy granules 🌱
- 2 spring onions 🧅
- 2 cloves of garlic 🧄
- 3 mushrooms 🍄
- 1 carrot 🥕
- 4 tbsp soy sauce 🧴
- 1 tbsp starch 🌿
Additionally:
- oil for frying 🛢️
- 100 ml water for steaming 💦
#HighProtein#WanTan#HealthyEating#Vegan
@dishes
Jellyfish have been eaten in Asia for centuries. People eat them in China, Japan, and Southeast Asia. They are processed with salt and alum to remove water and make them crunchy. Only certain species are safe to eat. Jellyfish are low in calories and high in protein. The processing tightens proteins, giving them a firm, crunchy texture. They are often served in salads, cold dishes, or as a crunchy snack.
🦑🥗🍴
[Read more]
@googlefactss
#JellyfishFood#AsianCuisine#SeafoodFacts#HealthyEating#FoodHistory
To ripen avocados fast, put them in a brown paper bag with an apple or banana. These fruits release a gas called ethylene that helps avocados ripen quicker, usually in 1 to 3 days. Keep the bag at room temperature and check daily. Avoid the fridge until they are ripe, or they won’t ripen properly. 🥑🍌🍎@googlefactss
#AvocadoRipening#FastRipen#KitchenTips#FruitRipening#HealthyEating
Cold weather and frost make many vegetables sweeter by increasing their sugar. Collards survive down to -9°C (15°F), beets down to -7°C (20°F), and both grow well if planted in late summer. Frost may damage some leaves but helps roots taste better.
Cover plants with row covers if it gets colder than -7°C (20°F) to protect them.
🌿❄️
@googlefactss
#WinterVeggies#FrostSweetened#ColdHardy#GardeningTips#HealthyEating
High Protein Vegetable Patties
🥕 Ingredients:
- 1 small carrot 🥕
- 1 medium potato 🥔
- 1/2 bell pepper 🌶
- 1 onion 🧅
- 50 g soy granules 🌱
- 50 g corn 🌽
- 50 ml water 💧
- 100 g flour 🌾
- 1 tbsp starch ✨
- Oil for frying 🍳
Preparation:
1️⃣ Grate the carrot & potato, dice the pepper & onion, and place in a bowl 🥣
2️⃣ Soak the soybean granules in water, then add to the bowl along with the remaining ingredients and mix well 👩🍳
3️⃣ Shape the dough into patties and sauté in a pan with a little oil until golden brown 🥘
Enjoy! 😋
#HighProtein#VegetablePatties#VeganRecipe#HealthyEating#PlantBased
@dishes
High Protein Vegetable Patties
🥕 Ingredients:
- 1 small carrot 🥕
- 1 medium potato 🥔
- 1/2 bell pepper 🌶️
- 1 onion 🧅
- 50 g soy granules 🌱
- 50 g corn 🌽
- 50 ml water 💧
- 100 g flour 🌾
- 1 tbsp starch ✨
- Oil for frying 🍳
Preparation:
1️⃣ Grate the carrot & potato, dice the pepper & onion, and place in a bowl 🥣
2️⃣ Soak the soybean granules in water, then add to the bowl along with the remaining ingredients and mix well 👩🍳
3️⃣ Shape the dough into patties and sauté in a pan with a little oil until golden brown 🥘
Enjoy! 😋
#HighProtein#VegetablePatties#VeganRecipe#HealthyEating#PlantBased
@dishes
🥞High Protein Cereal Pancakes 🥞
Ingredients:
🌾 160g flour
🥛 360 ml almond drink
💪 1 tbsp protein powder (optional)
✨ 1 tsp baking powder
🍯 1 tbsp agave syrup
🍏 2 tbsp apple cider vinegar
Toppings:
🥝 5 mini kiwis
🥥 200 ml plant-based drink
🌴 1 tsp date syrup
🍒 Pomegranate seeds
Preparation:
1️⃣ Mix all ingredients for the pancakes.
2️⃣ Fry a thumb-sized portion of dough over medium heat with a little oil.
3️⃣ Enjoy with your delicious toppings! 😋
---
#HealthyEating#HighProteinPancakes#VeganBreakfast#PancakeLovers@dishes
@dishes