TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #241 · 5 мај

Можно ли в Python создавать бинарные файлы? Конечно можно. Для этого в Python есть следующие инструменты: ▫️ тип данных bytes и bytearray ▫️ открытие файла в режиме wb (write binary) или rb (read binary) ▫️ модуль struct Про модуль struct поговорим в первую очередь. Файл в формате JSON или Yaml внутри себя содержит разметку данных. Всегда можно определить где список начался а где закончился. Где записана строка а где словарь. То есть формат записи данных содержит в себе элементы разметки данных. В binary-файле данные не имеют визуальной разметки. Это просто байты, записанные один за другим. Правила записи и чтения находятся вне файла. Модуль struct как раз и помогает с организацией данных в таком файле с помощью определения форматов записи для разных частей файла. Модуль struct преобразует Python-объекты в массив байт, готовый к записи в файл и имеющий определённый вид. Для этого всегда следует указывать формат преобразования (или, как оно здесь называется - запаковки). Формат нужен для того, чтобы выделить достаточное количество байт для записи конкретного типа объекта. В последствии с помощью того же формата будет производиться чтение. При этом следует помнить что мы говорим о типах языка С а не Python. Именно формат определяет, что записано в конкретном месте файла, число, строка или что-то еще. Вот какие токены формата у нас есть. Помимо этого, первым символом можно указать порядок байтов. На разных системах одни и те же типы данных могут записываться по-разному, поэтому желательно указать конкретный способ из доступных. Если этого не сделать, то используется символ '@', то есть нативный для текущей системы. В строке формата мы пишем в каком порядке и какие типы собираемся преобразовать в байты. Запакуем в байты простое число, токен "i". >>> import struct >>> struct.pack('=i', 10) b'\n\x00\x00\x00' Теперь несколько float, при этом нужно передавать элементы не массивом а последовательностью аргументов. >>> struct.pack('=fff', 1.0, 2.5, 4.1) b'\x00\x00\x80?\x00\x00 @33\x83@' Вместо нескольких токенов можно просто указать нужное количество элементов перед одним токеном, результат будет тот же. >>> struct.pack('=3f', 1.0, 2.5, 4.1) b'\x00\x00\x80?\x00\x00 @33\x83@' Теперь запакуем разные типы >>> data = struct.pack('=fiQ', 1.0, 4, 100500) я запаковал типы float, int и unsigned long long (очень большой int, на 8 байт) b'\x00\x00\x80?\x04\x00\x00...' Распаковка происходит аналогично, но нужно указать тот же формат, который использовался при запаковке. Результат возвращается всегда в виде кортежа. >>> struct.unpack('=fiQ', data) (1.0, 4, 100500) Как видите, ничего страшного! #lib#basic

Hashtags

Резултати

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

Пребарај: #dashboard

当前筛选 #dashboard清除筛选
Discord | Parser

@parserdiscord · Post #170 · 10.11.2025 г., 03:17

$CC Discord: link Ветка: community-updates —————————————————— 💬 Новое сообщение: [03:17:55] ## Attention Canton Network Users! I would like to start by saying how much we appreciate everyone in this community for integrating into what we at Canton Network and its ecosystem partners have worked so hard to build! We know that many of you have been early supporters, and some of you have simply shown up, so we want to do something special for all of you. I know there have been many discussions about an airdrop for specific role holders, but this will not be the typical airdrop you're used to, where all you needed to do was participate on mainnet or hold a role within the community. No, we will be offering a variety of opportunities for everyone to participate and earn fairly, with some extra leverage for those who have been helping to build Canton and share updates about what’s happening in the ecosystem. Canton Network is committing $50,000 in $CC (regardless of price fluctuations) to the community and here are all the ways you could potentially earn the rewards throughout the next 30 days: **Canton XP:** We will be introducing Canton XP (CXP) to the community. Canton Points will be integrated into the ecosystem using . We will release various tasks, quests, and opportunities to earn Canton Points. These could include attending an AMA, creating *quality* content for Canton, building with DAML, or simply helping users get more involved in the ecosystem. Our moderators will award different amounts of CXP for all these activities and more. The events might offer CXP rewards, Secret Role rewards, or just $CC rewards—you'll have to wait and see which events give what, but all rewards are valuable—and your roles matter too! There has been a lot of discussion about what your roles could provide, and we have the answer that fits here. These quests and tasks also give you the chance to earn multipliers for the CXP you receive, and yes, role multipliers stack! There will be role-specific opportunities as well as time-based multiplier opportunities, giving everyone a chance to climb the leaderboard! Just keep in mind, as easily as you can earn points, they can also be taken away from you bad actors. **Regional Channels:** Each regional channel, all 13, will have access to its own $1,000 and CXP that you can win within your local channel by completing events and tasks there. Your content will matter, your participation will matter, and, as always with me, your voice will matter. **Role Raffles:** Your roles are something many of you have worked hard for—creating content, participating in events, being a builder, or even just showing up early—and we believe that's an achievement in itself. Each role will have its own raffles where you can randomly win $CC just by entering. The roles eligible for raffles include , , , and (we may still do ). Each will have its own reward pool and raffle for you all to join. Sometimes you might win $50 in $CC; other times, it could be $500. We're giving the roles the opportunity to decide how much some of the raffles should be for. Each role will have a dedicated channel for discussions, but ultimately, the decisions will be put to a vote. Work together and consider whether one big prize for a raffle is worth it, or if multiple smaller raffles make more sense. The choice is yours. **Leaderboards:** All the CXP will accumulate until the end of the 30 days, placing you on a Drip Leaderboard. You can view this leaderboard in #dashboard as you earn CXP. At the end of the 30 days, we will award $CC rewards to the top participants ranked 1-500, with the top prize being $3000 to a single winner. Now, we will be sharing more and more details as time goes on but i will be sure to keep everyone updated. We kick things off tomorrow! —————————————————— 📖Дневник Тойошика

Hashtags

Dataviz jobs

@dataviz_jobs · Post #1984 · 28.04.2026 г., 11:07

В Binance (Taiwan, China) требуется: Business Intelligence Data Analyst. Из инструментов: Tableau / Qlik. https://remotefirstjobs.com/companies/binance/jobs/business-intelligence-data-analyst-777278 #foreign #dashboard

Dataviz jobs

@dataviz_jobs · Post #1973 · 27.04.2026 г., 09:31

В Dreamix требуется: Lead Data Engineer AWS Architect. Из инструментов: Power BI / Tableau / Looker. https://remotefirstjobs.com/companies/dreamix/jobs/lead-data-engineer-aws-architect-776829 #foreign #dashboard

Dataviz jobs

@dataviz_jobs · Post #1970 · 24.04.2026 г., 16:14

В Upwork требуется: Senior Analyst, Product Analytics: Marketplace. Из инструментов: Tableau / Looker. https://remotefirstjobs.com/companies/upwork/jobs/senior-analyst-product-analytics-marketplace-774354 #foreign #dashboard

Dataviz jobs

@dataviz_jobs · Post #1919 · 17.04.2026 г., 08:55

В Revelator требуется: Distribution Operations Director. Из инструментов: Tableau / Looker / Excel. https://remotefirstjobs.com/companies/revelator-ltd/jobs/distribution-operations-director-767319 #foreign #dashboard

123•••5•••10•••15•••20•••25•••30•••35•••40•••45•••50•••5455
ПретходнаСтраница 1 од 55Следна