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

Резултати

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

Пребарај: #ethena

当前筛选 #ethena清除筛选

FIVA Updates: What’s New 🏳️FIVA Protocol briefly dropped off the radar in early May, but it’s back with a full slate of improvements. Release highlights: ➡️Auto LP Flow – liquidity provision is now fully automated. ➡️Interface refresh – the Pools tab has a clearer design and smoother navigation. ➡️TX queue – transaction status appears in real-time notifications. ➡️YT/PT and APR charts – better data visualization. ➡️USD equivalents – easier P&L tracking. 🔦New farming options: ➡️ Added an EVAA/USDT pool and two SLP pools (USDT and TON). ➡️In partnership with #TorchFinance, the stgUSD stablecoin is now live; #Ethena integration is coming soon. 👌Season 1 results: ➡️ ~690 active farmers. ➡️ TVL topped $1.4 M; trading volume hit $1 M. ➡️ Rewards distributed: • 2.8 M 🤘 FIVA points • 105 M 😇 EVAA XP • 1.8 M 🐸 Storm RP FIVA keeps expanding its asset lineup and polishing the UI, with automation and user convenience front and center. FIVA App | Channel

Hashtags

TONlines – News

@tonlines · Post #7011 · 01.05.2025 г., 14:29

⚡️The Daily TON: Ethena Launch Details on TON #TON#Ethena The Daily TON shares new insights on Ethena's integration with TON, revealing that the USDe stablecoin will be supported by multiple wallets and integrated into various DEXes and lending services. Users can earn returns by staking USDe for tsUSDe tokens, with potential yields influenced by market conditions. No exact launch date is provided, but indications suggest a May release. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #7001 · 01.05.2025 г., 08:23

⚡️TON Community: Ethena Launches USDe Savings on TON #Ethena#TON The TON Community announces that Ethena is launching its dollar savings technology, USDe, on the TON blockchain, reaching Telegram's vast user base. This integration aims to simplify access to savings through various wallets such as Tonkeeper and MyTonWallet. Ethena, known for its rapid growth, brings significant opportunities with over $6 billion in TVL. Source: link @tonlines

Hashtags

Onchain Lens Channel

@OnchainLens · Post #5212 · 29.01.2026 г., 02:36

A wallet "0xd4d" received 465,000 $HYPE ($10.32M) from #Galaxy Digital OTC 2 hours ago. This wallet also received 56.12M $ENA ($24.76M) from #Ethena Lab Wallet 2.5 months ago but now worth $9.32M, resulting in a loss of $15.44M. Address: 0xd4d56a30a4a74…

Onchain Lens Channel

@OnchainLens · Post #5163 · 26.01.2026 г., 05:02

A wallet "0xd4d" received 465,000 $HYPE ($10.32M) from #Galaxy Digital OTC 2 hours ago. This wallet also received 56.12M $ENA ($24.76M) from #Ethena Lab Wallet 2.5 months ago but now worth $9.32M, resulting in a loss of $15.44M. Address: 0xd4d56a30a4a745f8ba732e8b453b7066260fbc10 https://x.com/OnchainLens/status/2015651462005817466 Follow @onchainlens for more onchain updates

TONlines – News

@tonlines · Post #7330 · 22.05.2025 г., 16:17

⚡️EVAA Announces New Additions to Main Pool #EVAA#Ethena The EVAA channel (@evaaprotocol) has introduced USDe and tsUSDe to its Main Pool. These synthetic dollar stablecoins are part of Ethena's technology, offering TON users seamless dollar savings and rewards. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #7451 · 30.05.2025 г., 12:11

⚡️Tonkeeper News: Ethena USDe Now on Tonkeeper #Ethena#Tonkeeper Tonkeeper News announces the integration of Ethena’s cryptocurrencies, USDe and its staked version tsUSDe, into the Tonkeeper app, expanding the TON ecosystem. Users can now send, receive, and swap these assets, enhancing their access to on-chain resources. Source: link @tonlines

TONlines – News

@tonlines · Post #7458 · 30.05.2025 г., 13:13

TON — LIVE: Ethena Chooses STON․fi for USDe Liquidity Pools #Ethena#STONfi Ethena has selected STON․fi to establish and manage USDe liquidity pools on the TON blockchain. Users can interact with the token through STON․fi’s app, offering exchange, staking, and pool participation in one interface. Source: link @tonlines

TONlines – News

@tonlines · Post #7003 · 01.05.2025 г., 08:38

⚡️EVAA Announces Ethena Launch on TON #TON#EVAA#Ethena EVAA has announced its support for the launch of Ethena in the TON ecosystem, as officially revealed at TOKEN2049. EVAA will serve as a Day 1 integration partner, highlighting its role in advancing stable and scalable onchain finance. Source: link @tonlines

TONlines – News

@tonlines · Post #7453 · 30.05.2025 г., 12:17

TON — LIVE: Integration of USDe Stablecoin in MyTonWallet #Ethena#MyTonWallet TON — LIVE shares that the USDe stablecoin from Ethena is now integrated into MyTonWallet. Users can also participate in staking with returns up to 18% annually. Source: link @tonlines

TONlines – News

@tonlines · Post #6805 · 17.04.2025 г., 08:31

⚡️The Daily TON: Ethena Brings Innovative Stablecoin to the Ecosystem #Ethena#stablecoin#TON The Ethena project plans to enter the TON ecosystem, introducing its unique stablecoin USDe. Unlike traditional stablecoins, USDe uses a hedging strategy to manage volatility, offering users potential yields on their holdings. The project aims to integrate with blockchain ecosystems, including a Telegram mini-app for broader accessibility. Source: link @tonlines

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