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

Резултати

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

Пребарај: #selfcustody

当前筛选 #selfcustody清除筛选
Crypto M - Crypto News

@CryptoM · Post #65103 · 11.04.2026 г., 01:36

🚀 Exodus Launches Self-Custody Payments App for Bitcoin and Stablecoins Exodus has introduced a new self-custody payments application, enabling users to spend Bitcoin and dollar stablecoins. According to NS3.AI, the app is compatible with merchants that accept Visa and Apple Pay, providing a seamless payment experience for cryptocurrency holders. #Exodus#Bitcoin#Stablecoins#SelfCustody#CryptoPayments#Visa#ApplePay#Cryptocurrency#BTC

Crypto M - Crypto News

@CryptoM · Post #65102 · 11.04.2026 г., 01:25

🚀 Exodus Introduces New Payment Feature for Select States Exodus, a publicly listed cryptocurrency wallet provider, has launched a new feature called Exodus Pay. According to Foresight News, this feature aims to transform its self-custody storage application into a tool for everyday payments. Currently, the service is available only to users in five states, including New York and California. #Exodus#PaymentFeature#ExodusPay#Cryptocurrency#SelfCustody#EverydayPayments#NewYork#California#ForesightNews

Crypto M - Crypto News

@CryptoM · Post #65248 · 12.04.2026 г., 09:35

🚀 Tether CEO Advocates for Open AI Development Tether CEO Paolo Ardoino has expressed his views on the development of artificial intelligence, stating that AI should be as open as freedom. According to Odaily, Ardoino criticized the centralized approach to AI development, describing it as a 'dead end.' In contrast to the closed AI systems being developed by major tech companies, Tether is exploring alternative methods through QVAC, which focuses on running AI models on local devices. This approach aims to give users control over their data and computing power, aligning with the crypto industry's core principle of self-custody, where users maintain autonomy over their data and computational resources. #Tether#CEO#AIdevelopment#openAI#freedom#centralizedAI#selfcustody#crypto#localdevices#dataprivacy

Crypto M - Crypto News

@CryptoM · Post #65024 · 10.04.2026 г., 14:21

🚀 France Advocates for Enhanced Crypto Regulations Amid MiCA Concerns French authorities are advocating for stricter cryptocurrency regulations, focusing on stablecoins issued by non-European entities. According to NS3.AI, a Bank of France official, Denis Beau, has called for tighter limits under the Markets in Crypto-Assets (MiCA) framework, specifically targeting non-euro stablecoin payments. Beau expressed concerns that the current MiCA rules only partially mitigate risks associated with the widespread adoption of these stablecoins. In addition, France's National Assembly has adopted a provision requiring self-custody reporting for cryptocurrency holdings exceeding a 5,000 euro threshold. However, this measure has not yet completed the legislative process, indicating ongoing discussions and potential adjustments before final implementation. The move reflects France's proactive stance in addressing regulatory challenges posed by the evolving crypto landscape. #France#crypto#regulations#stablecoins#MiCA#BankofFrance#DenisBeau#NationalAssembly#cryptocurrency#selfcustody#legislation

Venture Village Wall 🦄

@venturevillagewall · Post #4279 · 01.03.2025 г., 16:00

Swiss Central Bank Rejects Bitcoin Reserves Swiss National Bank President Martin Schlegel dismisses holding bitcoin as reserves, citing volatility and security issues. He emphasizes that cryptocurrencies don’t meet the necessary characteristics of a good currency. Read more Amidst market turbulence, Bitcoin saw a sharp decline, hitting an intraday low of $78,197 and trading below $80,000 at $79,875. BTC is down 7% today and 21.9% over the past month. Liquidations in derivatives reached $955.12 million, with significant amounts linked to bullish BTC and ETH positions. Market experts indicate the current downturn is less severe than previous crises, suggesting a healthy release of market risks. Kentucky passes a bill unanimously protecting Bitcoin Rights and self-custody, marking a significant legislative move for cryptocurrencies. #Bitcoin#Crypto#Finance#LazarusGroup#Ethereum#MarketTrends#Regulation#Volatility#Investing#Kentucky#BitcoinRights#SelfCustody#Trading#Liquidations#US#Banks#Macroeconomic#Arbitrage#MarketAnalysis#FTX#CryptoNews