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

Резултати

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

Пребарај: #sgunited

当前筛选 #sgunited清除筛选
REACH

@reachsg · Post #578 · 21.04.2020 г., 16:08

What are the services that will suspend operations from today till the end of Circuit Breaker? #SGUnited

Hashtags

REACH

@reachsg · Post #564 · 18.04.2020 г., 13:25

REACH Live! (Mandarin) Highlights #2 - How can we encourage the seniors to stay home? #SGUnited

Hashtags

REACH

@reachsg · Post #562 · 18.04.2020 г., 04:39

REACH Live! (Mandarin) Highlights #1 - Why should we wear mask whenever we go out? Let's hear from Ms Tin Pei Ling #SGUnited

Hashtags

REACH

@reachsg · Post #473 · 06.04.2020 г., 05:56

Tune into DPM Heng Swee Keat’s Solidarity Budget announcement later at 2PM today, where he will announce additional support for workers, businesses and households, to help tide them through this period. #SGUnited🇸🇬 📺 Catch the ‘live’ broadcast on CNA, on CNA938, and on Mediacorp’s meWATCH interactive service (www.mewatch.sg).

Hashtags

REACH

@reachsg · Post #228 · 12.03.2020 г., 13:42

[Sent by Gov.sg - 12 Mar] COVID-19 situation in S’pore - More imported cases expected as global numbers rise - More travel restrictions may be needed - If there are many cases here, may need to hospitalise only those seriously ill; those with mild symptoms to see GP, rest at home SG is NOT going to DORSCON Red — We have the situation under control Economic impact - Measures to help affected businesses, workers - Govt working on 2nd package of measures Staying #SGUnited 👩‍⚕ Frontline staff working hard 💪 Singaporeans’ support crucial to overcome this Everyone can do their part - Practise good personal hygiene, adopt new social norms 🧼🙌 - Maintain social distancing 👋 Watch: go.gov.sg/pmo12mar

Hashtags

NEA Singapore

@NEASingapore · Post #158 · 12.02.2021 г., 02:00

May you have good health and an OX-spicious new year! P.S. Use serving spoons and don’t double dip when having your reunion meals, let’s keep everyone safe and healthy! #SGUnited

Hashtags

REACH

@reachsg · Post #81 · 13.02.2020 г., 00:14

[Sent by Gov.sg - 13 Feb] 💪🇸🇬Helping those impacted by COVID-19: Contribute to The Courage Fund - To help those impacted by COVID-19 — patients, healthcare workers and those who need extra support www.comchest.sg/thecouragefund Go to the centralised online platform for ground-up efforts - Information on what’s needed - Information on ground-up groups and Govt-led initiatives - Details on platform soon Let’s show support for all in the healthcare and other sectors who have been working tirelessly. Look out for one another. #SGUnited

Hashtags

NEA Singapore

@NEASingapore · Post #46 · 24.04.2020 г., 04:00

Our hawkers are working hard to provide delicious food for all of us. So let’s show them our support by ordering takeaways or deliveries of our fave hawker dishes. Together we can overcome. #SGUnited

Hashtags

URA Singapore

@URASingapore · Post #46 · 29.06.2020 г., 11:11

🏃🏻‍♀️ Heading out to the stadiums? Check Space Out’s (www.spaceout.gov.sg) newly-added crowd level information at SportSG’s stadiums, and sweat it out in a safe environment. We are in Phase 2 but there’s no need to rush out. Keep our guard up and use Space Out for regular updates on crowd level information in malls, supermarkets, markets post offices and stadiums across Singapore. It’s also available in all four languages, and presents less crowded options near you. Crowd-level information on more places will be added in future. 👍🏼 Let’s continue to press on, stay safe, and be #SGUnited to fight this virus together.

Hashtags

MTI Singapore

@MTISingapore · Post #4 · 05.08.2021 г., 06:19

The Safe Management Measures have been tightened from 22 July to 18 August. More information on the SMM measures for F&B and Retail and Lifestyle establishments can be found in the infographics. Let's play our part against COVID-19 #SGUnited Click here for more details: https://go.gov.sg/updated-smm-advisory

Hashtags

MND Singapore

@mndsingapore · Post #172 · 01.05.2021 г., 02:14

It has been more than a year since COVID-19 happened. Many of us have had to adapt to new work situations and overcome the various challenges the pandemic brought with it. Today, we salute all workers, especially the frontliners who have been working extra hard to keep us safe this past year. Happy Labour Day! 💪🇸🇬 #SGUnited#SGTogether

123•••56
ПретходнаСтраница 1 од 6Следна