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

Резултати

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

Пребарај: #fundinground

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

@CryptoM · Post #64477 · 09.04.2026 г., 02:04

🚀 Anthropic Completes Secondary Market Equity Sale Anthropic has recently completed a secondary market equity sale, with some employees selling a small portion of their shares to investors. According to Odaily, the limited willingness of employees to sell resulted in several investors not receiving their planned share allocations. The transaction was priced in line with the company's latest funding round valuation from February this year, maintaining Anthropic's current valuation at $350 billion, excluding the $30 billion raised in this round. #Anthropic#EquitySale#SecondaryMarket#Employees#Investors#FundingRound#Valuation#TechNews

Crypto M - Crypto News

@CryptoM · Post #64471 · 09.04.2026 г., 01:47

🚀 OpenAI CFO Reports Strong Retail Investor Interest in Recent Funding Round OpenAI's Chief Financial Officer, Sarah Friar, revealed in an interview with CNBC that the company has begun exploring opportunities with retail investors in its latest funding round. According to Odaily, Friar noted that there has been a very strong demand from individual investors. Friar also mentioned that OpenAI plans to allocate a portion of shares for retail investors during its initial public offering (IPO). #OpenAI#CFO#retailinvestors#fundinground#IPO#SarahFriar#individualinvestors#CNBC

Crypto M - Crypto News

@CryptoM · Post #64949 · 10.04.2026 г., 12:06

🚀 Libeara Secures New Funding Round for Digital Infrastructure Development Libeara, a platform focused on the tokenization of real-world assets, has announced the completion of a new funding round. According to Odaily, the investment was made by AlloyX Ventures, a venture capital firm under Nasdaq-listed SOLOWIN HOLDINGS. The specific amount of the investment has not been disclosed. The newly acquired funds will be directed towards advancing compliant digital infrastructure. #Libeara#FundingRound#DigitalInfrastructure#Tokenization#RealWorldAssets#AlloyXVentures#SOLOWINHOLDINGS#VentureCapital

Venture Village Wall 🦄

@venturevillagewall · Post #3493 · 19.12.2024 г., 13:58

Vibly Fundraising Highlights Vibly has successfully raised $734.92K in its latest funding round, which took place on December 19, 2024. For more information, visit their website: Vibly. #Vibly#Funding#Investment#Startup#Tech#Finance#Innovation#Business#FundingRound#Capital#Growth#Entrepreneurship#Market#Development#Strategy#VentureCapital #2024

Venture Village Wall 🦄

@venturevillagewall · Post #3357 · 18.12.2024 г., 12:07

Fix AI Secures $500K Funding 🔹 Fix AI has successfully closed a funding round amounting to $500K on December 4, 2024. For more details, visit their website: Fix AI #Funding#AI#Investment#Tech#Startups#Innovation#Finance#Capital#Growth#Venture #2024 #Business#Entrepreneurship#Development#Project#Startup#Ecosystem#Technology#FundingRound#Launch

Venture Village Wall 🦄

@venturevillagewall · Post #3419 · 18.12.2024 г., 12:11

Tyme Raises $250M Round #Tyme has successfully raised a substantial $250 million in funding, closing the round on December 17, 2024. For more details, visit Tyme's website. #Funding#Tyme#Investment#Capital#Finance#Business#Technology#Startups#FundingRound#VentureCapital #2024 #Growth#Innovation#CapitalRaising#TechNews#Market#Entrepreneurship#StartUpFunding#FinancialServices

Venture Village Wall 🦄

@venturevillagewall · Post #3571 · 20.12.2024 г., 09:33

Ashry Steel Group Secures Funding *Ashry Steel Group* raises $46.15M in its latest funding round on December 19, 2024. For more details, visit their website here. #AshrySteelGroup#Funding#Investment#SteelIndustry#Finance#Growth#Capital#Business#Economy#Market#IndustryNews#Corporate#InvestmentRound#Startup#FundingRound#Entrepreneurship#Innovation

Venture Village Wall 🦄

@venturevillagewall · Post #3359 · 18.12.2024 г., 12:07

Aditto Secures $500K Funding Aditto raises $500K on December 4, 2024, focusing on custom-generated landing pages and search ads. For more information, visit Aditto. #Aditto#Funding#LandingPages#SearchAds#Investment#Startup#Tech#Marketing#DigitalMarketing#VentureCapital#OnlineAdvertising#Business#Innovation#Growth#Entrepreneurship#FundingRound

Venture Village Wall 🦄

@venturevillagewall · Post #4196 · 20.02.2025 г., 04:00

Aptos Accuses Monad of Code Theft Aptos research director Alexander Spiegelman has accused Monad of plagiarizing Aptos' open-source code. Monad co-founder James Hunsaker denied these claims, stating that BlockSTM is an extension and that no Aptos code has been utilized. Meanwhile, Monad recently secured $225M funding led by Paradigm, reaching a $3B valuation. More details: Wu Blockchain News #Aptos#Monad#Blockchain#Investing#Funding#Paradigm#SOL#Ethereum#DeFi#Crypto#VC#Tech#Innovation#OpenSource#FundingRound#Inflation#Protocols#Development#DEX#SecondSwap

Venture Village Wall 🦄

@venturevillagewall · Post #3398 · 18.12.2024 г., 12:10

Svakarma Finance Raises $10.4M Svakarma Finance successfully raised $10.40 million in funding on December 13, 2024. For more details, visit their website. #Funding#Finance#Svakarma#Investment#Capital#Startup #2024 #Market#Growth#Innovations#Loans#FinanceTech#DigitalFinance#Fintech#VentureCapital#Equity#FundingRound#FinancialServices#Economy

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