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

Резултати

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

Пребарај: #arbitrage

当前筛选 #arbitrage清除筛选
Daily Channels

@dailychannels · Post #6615 · 16.01.2026 г., 13:00

Channel: ArbitJet OFFICIAL Members: ~22.42K 💢 Username: @arbitjet_arbitrage Description: Welcome to the Official Arbitjet Channel! Advanced AI algorithms working 24/7, Transparent daily performance updates, Global community of forward-thinkers. Visit: www.ArbitJet.io. 🏷 Tags: #crypto_fx_trading #arbitrage#crypto_trading#arbitjet#bitcoin#trading https://telegramchannels.me/channels/arbitjet_arbitrage

DWF Labs Broadcast

@DWFLabs · Post #203 · 09.02.2023 г., 05:29

BIT x DWF Labs (Market Maker 101 series) What is the role of market making in the financial landscape? How has market making evolved with the growth observed in the #financial markets? In this article, we look into some of the market making strategies, as well as considerations and challenges for market makers. Full read here. #marketmaker#community#arbitrage#cryptocurrency

Venture Village Wall 🦄

@venturevillagewall · Post #3930 · 20.01.2025 г., 16:00

Market Volatility Due to $MELANIA Token Launch 📰 Significant market shifts after Melania Trump's $MELANIA token launch on Truth Social. 👉 $TRUMP token plummeted by 50%. 🔥 Bitcoin surged to $106,000 before dropping back to around $100K. 👥 Phantom wallet experienced up to 8M transactions/minute due to buying frenzy. 🌪️ Extreme price spreads created profitable arbitrage opportunities across platforms. 🚀 $MELANIA trading generated vast liquidity rewards. ⚠️ Risks involved: many faced losses from high fees and volatility. #MELANIA#Bitcoin#TRUMP#Crypto#Arbitrage#Liquidity#Volatility#DeFi#Trading#ETH#SOL#Phantom#NFT#RWA#Investments#MarketTrends#AI#Tech#Finance#Startups#VentureCapital

Crypto M - Crypto News

@CryptoM · Post #64610 · 09.04.2026 г., 10:34

🚀 Axis Launches Synthetic Dollar USDx in Private Testing Phase Axis, a quantitative yield protocol, has announced the introduction of its synthetic dollar, USDx, and completed its initial minting valued at $10 million. According to Foresight News, the USDx is currently in the private testing phase. Following the minting process, USDx has been deployed to Axis's market-neutral arbitrage engine, which spans over 40 trading venues. This deployment aims to provide liquidity and capture market spread opportunities. #Axis#SyntheticDollar#USDx#PrivateTesting#QuantitativeYield#Arbitrage#MarketNeutral#Liquidity#Trading#ForesightNews

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

Venture Village Wall 🦄

@venturevillagewall · Post #3670 · 21.12.2024 г., 14:37

Sticker Market Insights 🚀 An overview of the Sticker Market with upcoming NFT potentials. Stickers are gaining traction with unique IDs for future NFT conversion. Key collections include: - 🐔Flappy Bird: 5,555 editions; 733 sold. - 🐈‍⬛Blum: 10,268 sold from multiple editions. - 🐶DOGS: Some sold out with various editions. - 🐵Bored Apes: Sold out quickly with high ETH value. Key motivations for buying or holding: - Flipping and potential NFT benefits in EARN. - Increased arbitrage opportunities through expanded markets. Check out the StickerStore for purchases and Stars! #StickerMarket#NFT#FlappyBird#Blum#DOGS#BoredApes#PudgyPenguins#Notcoin#Onchain#EARN#Arbitrage#Stars#Telegram#Collectibles#DigitalArt#Crypto#MarketTrends#Community#Investment#Trading