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

Резултати

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

Пребарај: #cefi

当前筛选 #cefi清除筛选
Сигналы РЦБ Крипто

@usa100cks · Post #24887 · 11.02.2026 г., 17:19

#CeFi BlockFills приостановил ввод и вывод средств на фоне турбулентности рынка Криптокредитор BlockFills временно остановил клиентские депозиты и выводы, сославшись на высокую волатильность. Компания из Чикаго обслуживает около 2 000 институциональных клиентов и в 2025 году провела операций на $60 млрд. Торговля для части клиентов продолжается, но ликвидность ограничена.

Hashtags

HEXN.IO Channel

@hexnio · Post #706 · 25.01.2024 г., 13:01

🚀 New Listing: $CREDI Is Now Listed on the HEXN.IO Smart Exchange! 🚀 Another one has landed in our Smart Exchange! Explore Credefi (CREDI) with HEXN.IO, an all-in-one crypto platform that unites habitual and advanced approaches to money management. What is Credefi? Credefi Finance is a hybrid fin-tech solution that provides a state-of-the-art platform offering crypto lending and fiat borrowing collateralized with real-world assets. #RWA 💰 Credefi's mission is to bridge the gap in debt financing in the European Union and facilitate real-world impact by providing fair and accessible lending solutions to small and medium-sized enterprises (SMEs) in the region. 🏦 With Credefi, users can access reliable loans backed by a range of real-world assets, including real estate, future receivables, and more. The lending platform offers lenders stable and predictable returns generated from the real economy. 📈 Credefi works towards revolutionizing the alternative lending industry and making a positive difference in the world of #DeFi and #CeFi. Ready to explore CREDI? 👉 Start trading Credefi ($CREDI) on HEXN.IO now!

🗺 Travel the World | Private Expeditions

@expeditionsworldwide · Post #238 · 12.12.2020 г., 04:21

From #CeFi to #DeFi in one picture. The amount of fees on #Ethereum spent on $ETH deposits to centralized exchanges has fallen from ~25% in 2017 to less than 1% today. Almost all fees spent on txs involving centralized exchanges in the past months were used for ETH withdrawals.

Scary bonuses from Electra!❤️ 🚀Electra , the newest multi-chain DEX that combines the best features of #CeFi and #DeFi, one of the best startups at the Blockchain Life 2024 conference, has transformed its mini-app in honor of the main holiday of UPtober — Halloween!👁 Electra Spooky SeasonEvent😏started! Take advantage of holiday special: 🔼 Catch special Halloween boosters 🌈 Farm x2 points in Bulls'n'Bears! 🔮 Farm x2 points for BTC predictions. Hurry! Special game bonuses are available for a week only!🧪 🍲Farm Halloween points with Electra #electra#TON#DEX#DeFi#Web3

​​🎙CHOis one of few altcoins growing amidst this crypto winter. Over the summer, the Choise.com project, recently known as Crypterium, released the DeFi platform Charism, launched web3.0 interest accounts with notable 15% APY for USDT and USDC, announced the release of Web3.0 NFT Interest accounts and an extremely relevant product for the current market - crypto price insurance. CHO is planed to list in next CEX exchange Gate.io at 31 August. Token’s trading volume on CMC has shown Х3 after the event and amounted over $10K. 📌 ultra successful trading false start on gate.io 📌 Altcoin traded for $3M 📌 $3M price for $CHO token – trial listing on #Gate_io ⏰ Date of trading at gate.io: 31 August 💻 Website: https://choise.com/ ⚙️ Twitter: https://twitter.com/ChoiseCom #web3#listing#gate.io #Defi#CeFi

🤩Fintopio is a new non-custodial wallet in the TON ecosystem #Fintopio is a cryptocurrency wallet in🪙 Telegram, which can be used via mini app and website. With its help, you can conveniently use #DeFi and #CeFi functions, pay bills, divide expenses, buy goods and transfer money without leaving the application. To get started quickly, you can import an existing wallet: 🟡Open "DeFi" tab in the Fintopio app 🟡 Click "View all" 🟡 Next – “Import wallet” 🟡 Enter your 12-word secret phrase to import your wallet 👛Currently the wallet supports: #BTC, #USDT [#ERC20/#TRC20], #ETH, #TRX and #TON. 📲 The project has a game to attract an audience where $HP (Hold Points) are farmed. You need to collect coins every 8 hours and in the future you can exchange them for the main utility token of Fintopio named $HOLD. The token is only available to early participants of the project, the more you #HOLD, the more rewards you will receive from Fintopio. So it's better to start right now!🚀 Game | Channel | Website