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

Резултати

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

Пребарај: #cryptocurrencies

当前筛选 #cryptocurrencies清除筛选
Morningstar Ventures (News & Announcements)

@morningstar_ventures · Post #271 · 06.02.2024 г., 14:10

📢 PORTFOLIO UPDATE Congrats to our portfolio company, Meria Finance, on the launch of its app on the Apple Store and Google Play 👏 The team has worked hard to develop an intuitive one-stop platform to easily buy, exchange, withdraw, stake, and lend #cryptocurrencies. Download the app: ➡️here

DWF Labs Broadcast

@Dwflabs · Post #114 · 23.12.2022 г., 03:30

BIT x DWF Labs Crypto Snapshot [23 Dec] 📰 Highlights: 🔸Whales accumulate $726 Million In #Bitcoin 🔸Bank of International Settlements allow banks to hold 2% in #cryptocurrencies 🔸High net-worth investors continue to seek access to #crypto Full read here.

🗺 Travel the World | Private Expeditions

@expeditionsworldwide · Post #19 · 08.08.2020 г., 05:51

👀 India, Indonesia and Mexico are the most promising countries for cryptocurrency adoption. This conclusion was made by researchers at the venture capital firm Jump Capital based on the following factors: ▫️ the risk of high inflation / currency instability; ▫️ large flows of remittances; ▫️ immature financial infrastructure / lack of trust in banks; ▫️population; ▫️ the ratio of GDP / national wealth; ▫️ gold reserves; ▫️regulatory and banking environment; ▫️ a tendency to speculation (exchange trading, gambling, etc.). #cryptocurrencies#research

Libreware

@libreware · Post #1011 · 06.11.2021 г., 16:13

Haveno https://github.com/haveno-dex/haveno Private and decentralized way to #exchange#Monero for national currencies or other #cryptocurrencies. Haveno uses peer-to-peer networking and multi-signature escrow to facilitate trading without a trusted third party custodian. Disputes can be resolved using non-custodial arbitration. Everything is built around Monero and Tor. Haveno is the Esperanto word for "Harbor". The project is stewarded by a core Team, currently formed by 2 people: ErCiccione and Woodser. See the FAQ in the wiki for more information about the project https://github.com/haveno-dex/haveno/wiki/FAQ Haveno is still work in progress. There are no binaries available at this stage. If you want to test Haveno you have to compile it first (see https://github.com/haveno-dex/haveno/blob/master/docs/installing.md). Status of the project At the moment Haveno is only a Proof of Concept. It's already possible to initiate crypto <-> XMR and fiat <-> XMR trades, but the platform still needs a lot of work before being available for public use.

Daily Channels

@dailychannels · Post #6559 · 21.12.2025 г., 01:00

Channel: Bitcoin & Ethereum Trading Members: ~24.05K 💢 Username: @bitcoin_ethereum_trading Description: Bitcoin and Ethereum Trading all for free 🏷 Tags: #crypto_fx_trading #ethereum#bitcoin#crypto#cryptocurrencies https://telegramchannels.me/channels/bitcoin_ethereum_trading

Daily Channels

@dailychannels · Post #6774 · 26.03.2026 г., 13:00

Group: ZombieSquad Community Members: ~14.09K 💢 Username: @zombiesquadhq Description: 🔥 Come play the game and earn sunlight, with a chance to score some airdrop rewards! 🏷 Tags: #airdrop #cryptocurrencies#aichatbot#airdrop#crypto https://lve.to/k1gt8zxptq

SIGNAL

@finsignal · Post #3846 · 27.05.2025 г., 14:34

⚠️#Google here gave the holder of #cryptocurrencies a dose of anxiety with the news that quantum computers will be able to hack the military-technical cooperation network much earlier than current forecasts. ⚠️ To #crack RSA encryption, you need 20 times less resources than expected (less than 1 million qubits). Modern quantum computers are much weaker, but their power is constantly progressing. According to various forecasts, it will be possible to cross the 1 million cubic meter mark after 2030.👀

🦅 [ perspective ix ]

@perspectiveix · Post #1208 · 17.04.2018 г., 19:30

​​💰The Top Ten Cryptocurrencies 1. Bitcoin 2. Ethereum 3. Ripple Bitcoin jumped back up over the $8,000 dollar mark on 13 April 2018. As this infographic shows, while #Bitcoin is by no means alone in the world of #CryptoCurrencies, it is by far the most valuable #CryptoCurrency, with a total market cap of over $133 billion. According to figures from CoinMarketCap, #Ethereum is the closest alternative, but with only $49 billion. 🚀@PerspectiveIX 🌀 ⁣http://prs.pctvix.co/TelegramIX ❓ Do you own any cryptocurrency? 👍🏻 Yes 🤔 Not yet, but thinking about buying some 👎🏻 No, and I'm not interested at all

ПретходнаСтраница 1 од 3Следна