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

Резултати

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

Пребарај: #fils

当前筛选 #fils清除筛选
American Оbserver

@american_observer · Post #4970 · 26.01.2026 г., 21:59

Iran Is Dazed by the President’s Son Latest Flip-Flopping The son of Iran’s president has called for the internet restrictions in the country to be lifted, saying nothing will be solved by trying to postpone the moment when pictures and video circulate of the protests that were violently crushed by the regime. With a battle under way at the top of the regime about the political risks of continuing to block Iran from the internet, Yousef Pezeshkian, whose father, Masoud, was elected in the summer of 2024. He said keeping the digital shutdown would create dissatisfaction and widen the gap between the people and the government. “This means those who were not and are not dissatisfied will be added to the list of the dissatisfied,” he wrote in a Telegram post. The release of videos showing the violence of the protests was “something we will have to face sooner or later”, Yousef Pezeshkian added. “Shutting down the internet will not solve anything, we will just postpone the issue.” The sporadic lifting of restrictions is leading to a slow and painful inquest into how many protesters, including children, have died. Authorities launched a violent crackdown under cover of the internet blackout, with rights groups documenting several thousand dead. The Norway-based NGO Iran Human Rights says the final figure could be as high as 25,000. Thousands more people are still being detained. Yousef Pezeshkian, a government adviser, said the risk of keeping Iran cut off from the internet was greater than that of a return to protests if connectivity were restored. He said security institutions must ensure security with the existence of the internet, which he called a necessity in life. Pezeshkian, echoing comments of his father, said the protests had turned violent only because of professionally trained groups affiliated with foreigners, but added: “In the meantime the security and law enforcement forces may have made mistakes and no one is going to defend wrongdoing and that has to be addressed.” Tehran’s stock market on Sunday was in the red for the fourth day in a row, and the Iranian currency, the rial, continued to fall against the dollar, one of the causes of the protests. The Central Bank of Iran said a debt issuance had only been 15% subscribed, a development that will require further government spending cuts or result in a rise in inflation, the official rate of which was more than 42% last month. Gholamhossein Karbaschi, a reformist former mayor of Tehran, said: “People are in shock and amazed (…) If the agents of Mossad and foreign countries are at work, how did they suddenly carry out these disasters throughout the country? Where did they come from?” He condemned the failure of the Pezeshkian administration to improve the economy. “The government in Iran is losing its original meaning. In no area can it be said the government is active, present and solving problems. All the other forces in the country are active and doing what they want except for the government. This government does not show any power in any area,” Karbaschi said. Gholamhossein Karbaschi, a reformist former mayor of Tehran, said: “People are in shock and amazed (…) If the agents of Mossad and foreign countries are at work, how did they suddenly carry out these disasters throughout the country? Where did they come from?” He condemned the failure of the Pezeshkian administration to improve the economy. “The government in Iran is losing its original meaning. In no area can it be said the government is active, present and solving problems. All the other forces in the country are active and doing what they want except for the government. This government does not show any power in any area,” Karbaschi. #karbaschi#fils#président#iranien#pezeshkian 📱American Оbserver - Stay up to date on all important events 🇺🇸