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

Резултати

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

Пребарај: #naturefacts

当前筛选 #naturefacts清除筛选
Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40360 · 19.12.2025 г., 07:04

Mother llamas hum to their babies to help them recognize each other. Each hum is special and unique. This helps the mother find her baby in the herd. It also keeps the babies safe by avoiding confusion. 🦙🎶 [Read more] @googlefactss#Llamas#AnimalCommunication#NatureFacts

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40486 · 06.01.2026 г., 07:03

Echidnas are fascinating egg-laying mammals native to Australia and New Guinea. There are three surviving species. They belong to a group called monotremes, which are unique because they lay eggs instead of giving birth to live young. Echidnas have spiky coats like a hedgehog and long, sticky tongues to catch ants and termites. Despite their spiky appearance, they are shy and solitary creatures. They dig burrows and are excellent swimmers too! 🦔🥚🍼🇦🇺 [Read more 1] [Read more 2] [Read more 3] @googlefactss #Echidna#Monotreme#AustralianWildlife#NatureFacts

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40808 · 16.03.2026 г., 15:00

Snow leopards are sometimes seen biting or holding their own tails. Scientists think they may do this to stay warm in cold mountain habitats or to play. A snow leopard’s long, thick tail also helps it balance on steep rocky cliffs and can wrap around its body like a blanket. 🐆❄️🐾 [Read more 1] [Read more 2] @googlefactss #snowleopard#animalfacts#wildlife#naturefacts#bigcats#didyouknow

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40407 · 25.12.2025 г., 07:03

Crows give gifts to people who feed them. They remember faces and bring shiny or interesting things like buttons or beads. This shows crows can be smart and friendly. They use gifts to build trust with humans. [Read more] @googlefactss🐦‍⬛🎁#Crows#GiftGiving#SmartBirds#Animals#NatureFacts

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40495 · 07.01.2026 г., 15:03

Myth: opposums sleep while hanging by their tails. Fact: Opossums do not hang upside down by their tails 🐾. Their tails are strong for gripping branches and carrying nesting materials but can’t hold their full weight for long. Young opossums might dangle briefly but don’t sleep that way. They “play possum” by pretending to be dead when scared, which helps protect them from predators. 🌙🐾🌳 [Read more] @googlefactss#PossumFacts#AnimalBehavior#NatureFacts#MythBusted#DisneyWasWrong

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40696 · 23.02.2026 г., 23:01

Plants make ultrasonic sounds when stressed. This happens if their stems are cut or they do not get enough water. Humans cannot hear these sounds without special microphones. Scientists have recorded them and found stressed plants make more pops and clicks than healthy ones. The noises come from tiny air bubbles forming and collapsing inside plant tissues. Aka cavitation. It is a physical reaction, not a sign of pain like animals feel. Some animals, like mice, bats, or insects, can hear these sounds. Machines and AI can too. By “listening” to plants, AI or bots with specialized sensors can tell when a plant is stressed or needs water. Farmers could use this to care for crops earlier, before signs appear. 🌱🔊🤖 [Read more] [Read more] @googlefactss #PlantScience#Ultrasound#NatureFacts#Plants#AI#PlantCare#SmartFarming#Environment#DIY