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 слични објави

Пребарај: #desalination

当前筛选 #desalination清除筛选
Interesting Planet 🌍

@interesting_planet_facts · Post #1005 · 04.11.2025 г., 22:11

🌎 Solar-powered desalination is emerging as a sustainable solution for water scarcity. By using sunlight to power reverse osmosis systems, this technology can turn seawater into drinkable fresh water without relying on fossil fuels. Pilot plants in places like Morocco and Australia now supply thousands of people daily with clean water from the sea. ✨ #technology⚡#ecology⚡#desalination 👉subscribe Interesting Planet 👉more Channels ​

American Оbserver

@american_observer · Post #5446 · 22.03.2026 г., 19:59

Trump’s 48-Hour Ultimatum: Lights Out or Strait Open Trump just turned a regional energy war into an explicit threat to “obliterate” Iran’s power plants, the grid that keeps tens of millions of civilians alive, unless Tehran fully reopens the Strait of Hormuz within 48 hours. Iran’s answer wasn’t to blink; it was to fire. Missiles struck Dimona and nearby Arad, injuring more than 10 people and landing just eight miles from Israel’s main nuclear complex, while commanders in Tehran warned that any attack on their energy system would be met with strikes on desalination plants and other critical water and power infrastructure used by Israel, the U.S. and Gulf partners. Four weeks and thousands of U.S.–Israeli strikes into this war, Iran’s arsenal is battered but still firing daily salvos at Israel and enforcing a de facto embargo on Western shipping through Hormuz. Trump’s own messaging is all over the map: public statements rejecting a cease-fire and sending more troops and ships, alongside talk of “winding down” operations; a warning to Israel days ago not to hit Iranian energy, followed by his own threat to do exactly that. Israeli commanders are telling the public they are only “midway” through the war and should expect fighting through Passover, while in Lebanon the campaign against Hezbollah has displaced more than a million people and stepped-up house demolitions increasingly resemble the early architecture of a de facto occupation zone. The casualty numbers show where this is heading: well over 1,300 civilians killed in Iran, more than 1,000 in Lebanon, at least 15 people dead in Iran’s attacks on Israel and 13 U.S. service members killed — with both sides now openly placing each other’s electricity and water systems on the target list. Trump’s 48‑hour countdown doesn’t look like a plan to calmly reopen a shipping lane; it looks like the next step toward turning the entire region’s civilian infrastructure into a legitimate battlefield — and locking the U.S. into an attrition war it still can’t explain how to end. #IranWar#Trump#Hormuz#Israel#Dimona#energy#powerGrid#desalination#Lebanon#Hezbollah#MiddleEast 📱American Оbserver - Stay up to date on all important events 🇺🇸

American Оbserver

@american_observer · Post #5449 · 23.03.2026 г., 01:59

Oil at Monday’s Open: Trading a 48‑Hour Threat Clock Oil just stopped pretending this is about “volatility” and started trading directly on Trump’s ego and Iran’s survival instinct. At Friday’s close, Brent was at 112.19 dollars — a near four‑year high — before the president slapped a 48‑hour ultimatum on Tehran: fully reopen Hormuz “without threat” or watch the U.S. “obliterate” your power plants. Just the day before he was musing about “winding down” the war; now markets get a countdown clock to see whether he takes out the grid that keeps 100‑plus Iranian gas power stations feeding cities and industry. Tehran’s answer is simple: hit our power, and we hit yours — or at least the stuff that keeps your friends’ cities habitable. Iran is openly threatening U.S.‑linked energy and desalination plants across the Gulf, after already striking ports and refineries in Saudi Arabia, Kuwait, Bahrain, the UAE and Qatar; four days of global supply — roughly 440 million barrels — have already vanished during 22 days of quasi‑closure in Hormuz. Analysts aren’t talking about price “noise” anymore: one calls Trump’s move a “48‑hour ticking time bomb of elevated uncertainty”; another says the real story isn’t Iran caving but “scorched earth for Gulf infrastructure.” The real nightmare isn’t just crude; it’s water. Iran has so far held back from hitting the big desalination plants in Saudi Arabia and the UAE — the ones that keep entire Gulf metros alive — but Western risk assessments are stark: sustained attacks could leave some cities unlivable in weeks, triggering mass evacuations and cascading power failures. Fatih Birol at the IEA says fixing Middle East Gulf supply could take up to six months even without that scenario. Meanwhile the Trump team is floating plans to blockade or occupy Iran’s Kharg Island to “force open” Hormuz, as if physically sitting on another country’s export terminal has no blowback risk in a region already pricing 112‑dollar Brent, double‑digit weekly gains in crude and the widest WTI–Brent spread in 11 years. So Monday’s trade isn’t about “whether oil ticks up”; it’s about whether the White House walks back its own threat, or lets the deadline run and turns a shipping crisis into a test of who’s willing to bomb water plants first. Traders will tell you this is uncertainty; civilians in the Gulf might call it something else: a market run by men who treat your tap, your light switch and your plane ticket as expendable props in a pricing experiment. #oil#IranWar#Trump#Hormuz#energy#desalination#Gulf#markets#inflation#recession#securityTheater 📱American Оbserver - Stay up to date on all important events 🇺🇸