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

Резултати

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

Пребарај: #john

当前筛选 #john清除筛选
Pensive|

@PensivePost · Post #4777 · 20.01.2021 г., 14:26

*FRACTION OF SECONDS* Woke up. I knew I was late. Coz that was my routine. And coz of a simple logic, why be excited to wake up early and go to a place you hate and do something that you hate! I sighed when my mouth tasted coffee before colgate...Ahh! how I love normal days, It was a normal day. At least that's what I thought. Papa was there looking up from the newspaper at me with a sense of pity. I sort of ignored that and walked out through the front door, but the next sight, a brand new beautiful ladybird and an even more beautiful rider, with short black hair waving in the wind, in a skirt that knew well not to cover her beautiful legs... Well I couldn't ignore that! Just a fraction of seconds and I had already captured her. Made her mine. Is this what they call... Oops!! She looked at me. Damn it! She caught me staring at her! I looked away whistling. I looked again, did I see a smile? I heard Mom shouting my name out aloud. I knew I had to rush. As I was rushing inside I heard a loud thud. I turned back and saw the beautiful ladybird lying on the road. It was only a fraction of second, yet my mind talked to me in infinite speed...Somethings...what did he say I don't remember anymore. I remember rushing back to the house. One year I didn't talk to our new neighbour who was an year older than me.Days went by. Mom had started packing things up one evening I came back from school. Papa received his transfer letter. Now whenever I see a cycle I think. What would've happened? Why hadn't I stopped my mind talking to me? Why hadn't I I rushed 'out'side than 'in'side? All in a fraction of second! #JOHN PAUL BENOY #Review

Hashtags

Pensive|

@PensivePost · Post #4778 · 20.01.2021 г., 14:26

*FRACTION OF SECONDS* Woke up. I knew I was late. Coz that was my routine. And coz of a simple logic, why be excited to wake up early and go to a place you hate and do something that you hate! I sighed when my mouth tasted coffee before colgate...Ahh! how I love normal days, It was a normal day. At least that's what I thought. Papa was there looking up from the newspaper at me with a sense of pity. I sort of ignored that and walked out through the front door, but the next sight, a brand new beautiful ladybird and an even more beautiful rider, with short black hair waving in the wind, in a skirt that knew well not to cover her beautiful legs... Well I couldn't ignore that! Just a fraction of seconds and I had already captured her. Made her mine. Is this what they call... Oops!! She looked at me. Damn it! She caught me staring at her! I looked away whistling. I looked again, did I see a smile? I heard Mom shouting my name out aloud. I knew I had to rush. As I was rushing inside I heard a loud thud. I turned back and saw the beautiful ladybird lying on the road. It was only a fraction of second, yet my mind talked to me in infinite speed...Somethings...what did he say I don't remember anymore. I remember rushing back to the house. One year I didn't talk to our new neighbour who was an year older than me.Days went by. Mom had started packing things up one evening I came back from school. Papa received his transfer letter. Now whenever I see a cycle I think. What would've happened? Why hadn't I stopped my mind talking to me? Why hadn't I I rushed 'out'side than 'in'side? All in a fraction of second! #JOHN PAUL BENOY #Review #short story

American Оbserver

@american_observer · Post #5212 · 24.02.2026 г., 16:19

Former US National Security Advisor John Bolton: “Although you could potentially remove the ayatollah, that would leave the IRGC in place, and the government in Iran is the IRGC, while the ayatollahs act as a religious cover or an ideological cover for them. I think Trump is just hoping that this show of American power will intimidate the ayatollahs. If I were still his adviser, I would be happy to tell him that it won’t work. They won’t be intimidated. But Trump really thinks minute by minute; he doesn’t think strategically.” #john#bolton#trump#ayatollah 📱American Оbserver - Stay up to date on all important events 🇺🇸