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

Резултати

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

Пребарај: #protocol

当前筛选 #protocol清除筛选
TONlines – News

@tonlines · Post #7340 · 23.05.2025 г., 10:49

EVAA Protocol: Temporary Suspension of stTON in Main Pool #protocol#liquidity EVAA has temporarily suspended the use of stTON as collateral in its Main Pool due to reduced market liquidity. Existing positions remain unaffected, but users must repay active loans before withdrawing stTON. The measure is temporary and will be lifted once liquidity conditions improve. Source: link @tonlines

以太坊区块链新闻| ETH 以太币圈热瓜

@ethereumglobalnews · Post #1426 · 27.11.2025 г., 08:58

🪙Vitalik expects ETH gas limits to grow with precision. #Scaling 以太坊創辦人 Vitalik Buterin (26)日表示2026 年的區塊 Gas 上限仍會走升,但將擺脫過往「全面平均式調高」的模式,改為 更精準、針對性更強的調整節奏。 #Protocol#DeFi#市场趋势#以太坊 ——— ⚡️ 此舉意味著以太坊擴容將從「粗放擴大」走向「精細調節」,並與帳戶抽象、資料可用性改革形成更一致的技術路線。 ✅Chat: @Web3NewsInsight 🦂 👇Tip👇讚 或點擊進行💎資源搜索👇

Crypto currents | Money, Games, News.

@cryptocurrentsglobal · Post #3042 · 08.02.2025 г., 08:47

🔤🔤🔤🔤🔤🔤🔤 Guys, some of you already heard about testnets, some of you not. We would like to introduce you the first one called, Humanity protocol. You need to claim your reward every 6 hours without clicking, entering combo and etc. $RWT token is already trading. Join humanity protocol👉link #Testnet#Humanity#Protocol

DWF Labs Broadcast

@Dwflabs · Post #22 · 01.09.2022 г., 08:12

DWF LABS makes another move to consolidate its position as one of the world’s leading Market Makers in #crypto, through a secondary investment in the MXC Foundation www.mxc.org - The MXC Foundation is the steward of the MXProtocol and the #MXC token. The MXC #token is listed on the world’s top exchanges, and starting on August 31st, MXC can be traded on Coinbase. DWF Labs made a multi-million dollars secondary market #investment in the MXC tokens and has been appointed as Market Maker. #web3#marketmaking#protocol

Crypto M - Crypto News

@CryptoM · Post #65270 · 12.04.2026 г., 13:09

🚀 StarkWare Researcher Proposes Complex Bitcoin Transaction Scheme StarkWare researcher Avihu Mordechai Levy has introduced a Bitcoin transaction scheme that aims to circumvent the need for a protocol change. According to NS3.AI, the proposed method involves solving a pre-broadcast puzzle, which would necessitate approximately 70 trillion attempts. Levy characterized this design as a last-resort solution due to its significant computational demands, large transaction size, and potential relay-policy challenges, all of which could hinder scalability. #StarkWare#Bitcoin#transaction#AvihuMordechaiLevy#protocol#computationaldemands#scalability#relaypolicy#BTC

Venture Village Wall 🦄

@venturevillagewall · Post #4025 · 30.01.2025 г., 01:00

Bitcoin Dominates Market with Huge Gains Tesla's bitcoin holdings surge to $1.076 billion, boosting GAAP revenue by $600M. 🎉 The Sei Foundation launches a $65M fund for decentralized science startups, while GMCI unveils an index for US crypto protocols. Notably, Texas announces plans for a Bitcoin Reserve. Read more about Tesla's valuation increase here. Explore the Sei Fund details here and GMCI's index here. #Bitcoin#Tesla#DeSci#VC#Crypto#Funding#Texas#Cryptocurrency#Investment#MarketTrends#GMCI#Sei#Startups#Blockchain#Protocol#Accounting#Finance#Legislation#Innovation#CryptoProtocol

Venture Village Wall 🦄

@venturevillagewall · Post #4221 · 23.02.2025 г., 04:00

Ethereum Rollback Not Feasible, Developer Warns Ethereum developer Tim Beiko cautions against rolling back the Bybit attack, citing potential widespread disruptions and significant costs exceeding $1.5 billion. This attack does not breach Ethereum protocol rules unlike the 2016 TheDAO incident. Additionally, a Bybit address transferred $48 million to Galaxy Digital and FalconX, acquiring 34,800 ETH shortly before depositing it back into Bybit. Read more: Ethereum rollback debate and Bybit address transactions #Ethereum#Bybit#Crypto#Blockchain#DeFi#News#Investment#ETH#GalaxyDigital#FalconX#TimBeiko#CZ#KanyeWest#Polychain#OTC#Transaction#Security#Protocol#Rollback#Market#Analysis

Crypto M - Crypto News

@CryptoM · Post #65093 · 11.04.2026 г., 00:26

🚀 Polymarket to Upgrade Protocol and Launch pUSD Token on Polygon Polymarket has announced plans to enhance its protocol and introduce pUSD, an ERC-20 collateral token on the Polygon network, fully backed by USDC. According to NS3.AI, the upgrade aims to lower gas costs and minimize failed trades. The platform intends to open-source the smart contracts next week and will initiate a bug bounty program to ensure security and reliability. #Polymarket#Upgrade#Protocol#pUSD#ERC20#CollateralToken#Polygon#USDC#GasCosts#FailedTrades#OpenSource#SmartContracts#BugBounty#Security#Reliability

GitHub Trends

@githubtrending · Post #14847 · 20.06.2025 г., 12:30

#java#bedrock#bedrock_edition#bedrock_to_java#bungee#fabric#geyser#geysermc#hacktoberfest#java#java_edition#minecraft#minecraft_bedrock_edition#packet#pe#protocol#proxy#spigot#translator#velocity Geyser is a free tool that lets you play Minecraft across different versions by connecting Minecraft Java Edition servers. It works by translating data between the two game versions, enabling cross-platform play on devices like Windows, iOS, Android, and consoles. You can install it as a plugin or standalone, and it supports recent Minecraft versions. This means you can join Java servers even if you only have Bedrock Edition, expanding your multiplayer options without needing a separate Java account if you use the Floodgate plugin. It’s great for seamless crossplay but may have some minor limitations due to game differences[1][2][5]. https://github.com/GeyserMC/Geyser