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

Резултати

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

Пребарај: #bonds

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

@tonlines · Post #7440 · 29.05.2025 г., 16:14

⚡️Pavel Durov: Successful $1.7B Bond Issuance by Telegram #Telegram#bonds Pavel Durov announced that Telegram has issued $1.7B in 5-year bonds, maturing in 2030, with a 9% interest rate. This issuance allows Telegram to refinance more than $950M of previous bonds, enhancing its financial position significantly. Source: link @tonlines

TONlines – News

@tonlines · Post #7435 · 29.05.2025 г., 13:11

⚡️TON — LIVE: Telegram Secures $1.7 Billion #Telegram#bonds TON — LIVE reports that Telegram has raised $1.7 billion through convertible bonds to repay existing debt and extend debt maturity. This financing follows a recent announcement about securing $1.5 billion with investors like BlackRock, Mubadala, and Citadel. Source: link @tonlines

Venezuelanalysis

@venanalysis · Post #1803 · 09.11.2024 г., 21:34

The US Treasury has extended a ban on transaction involving the PDVSA 2020 bond, stopping holders from exercising the collateral and seizing CITGO shares. At the same time, a court-mandated auction of the US-based refiner remains mired in controversy. Read the report: https://venezuelanalysis.com/news/venezuela-us-treasury-department-extends-citgo-protection-amid-auction-controversy/ #CITGO#Venezuela#Sanctions#Bonds

📈Bond Market: Sequencing, Not Intensity, Drives US10Y Below 4% In a bond market characterized by nuanced movements, the next 72 hours will be defined by the sequencing of events rather than headline intensity. US 10-Year Treasury yield slips below 4% again,... 🔗Read Full Analysis 🎯 SPECIAL OFFER: 15% OFF 💸 Coupon Code: salenow15% 🚀 Upgrade to premium signals → https://markets.fxpremiere.com/en/signals?utm_source=telegram #Bonds#YieldCurve#MarketAnalysis

📈Convexity Risk Lingers in Bond Markets: US10Y at 4.054% Despite recent market calm, convexity risk in bond markets has not disappeared; it has merely become less visible. Analysis reveals that while front-end noise can be tactical, structural shifts... 🔗Read Full Analysis 📡 Get free trading signals → https://markets.fxpremiere.com/en/signals?utm_source=telegram #Bonds#YieldCurve#MarketAnalysis

UzCSD | Markaziy depozitariy

@uzcsd · Post #2837 · 18.11.2022 г., 14:04

End-of-week depositary statistics OVERVIEW OF SECURITIES ISSUES SAFEKEPT BY THE CENTRAL SECURITIES DEPOSITORY The aggregate number of shares issues totaled 2093, while of corporate bonds totaled 30 as of 18.11.2022. The aggregate volume of issued shares totaled UZS 165 622.4 billion, while of corporate bonds totaled UZS 1 011.4 billion. #issues#shares#bonds#infographics#statistics deponet.uz|Tg|Fb|Inst|Youtube

UzCSD | Markaziy depozitariy

@uzcsd · Post #2821 · 11.11.2022 г., 13:04

End-of-week depositary statistics OVERVIEW OF SECURITIES ISSUES SAFEKEPT BY THE CENTRAL SECURITIES DEPOSITORY The aggregate number of shares issues totaled 2092, while of corporate bonds totaled 30 as of 11.11.2022. The aggregate volume of issued shares totaled UZS 165 616.4 billion, while of corporate bonds totaled UZS 1 011.4 billion. #issues#shares#bonds#infographics#statistics deponet.uz|Tg|Fb|Inst|Youtube

UzCSD | Markaziy depozitariy

@uzcsd · Post #2800 · 04.11.2022 г., 14:33

End-of-week depositary statistics OVERVIEW OF SECURITIES ISSUES SAFEKEPT BY THE CENTRAL SECURITIES DEPOSITORY The aggregate number of shares issues totaled 2091, while of corporate bonds totaled 30 as of 04.11.2022. The aggregate volume of issued shares totaled UZS 165 616.2 billion, while of corporate bonds totaled UZS 1 011.4 billion. #issues#shares#bonds#infographics#statistics deponet.uz|Tg|Fb|Inst|Youtube

UzCSD | Markaziy depozitariy

@uzcsd · Post #2786 · 28.10.2022 г., 13:34

End-of-week depositary statistics OVERVIEW OF SECURITIES ISSUES SAFEKEPT BY THE CENTRAL SECURITIES DEPOSITORY The aggregate number of shares issues totaled 2090, while of corporate bonds totaled 30 as of 28.10.2022. The aggregate volume of issued shares totaled UZS 165 616.2 billion, while of corporate bonds totaled UZS 1 011.4 billion. #issues#shares#bonds#infographics#statistics deponet.uz|Tg|Fb|Inst|Youtube

UzCSD | Markaziy depozitariy

@uzcsd · Post #2778 · 21.10.2022 г., 15:04

End-of-week depositary statistics OVERVIEW OF SECURITIES ISSUES SAFEKEPT BY THE CENTRAL SECURITIES DEPOSITORY The aggregate number of shares issues totaled 2085, while of corporate bonds totaled 30 as of 21.10.2022. The aggregate volume of issued shares totaled UZS 164 689.5 billion, while of corporate bonds totaled UZS 1 011.4 billion. #issues#shares#bonds#infographics#statistics deponet.uz|Tg|Fb|Inst|Youtube

UzCSD | Markaziy depozitariy

@uzcsd · Post #2763 · 14.10.2022 г., 14:49

End-of-week depositary statistics OVERVIEW OF SECURITIES ISSUES SAFEKEPT BY THE CENTRAL SECURITIES DEPOSITORY The aggregate number of shares issues totaled 2084, while of corporate bonds totaled 30 as of 14.10.2022. The aggregate volume of issued shares totaled UZS 164 619.5 billion, while of corporate bonds totaled UZS 1 011.4 billion. #issues#shares#bonds#infographics#statistics deponet.uz|Tg|Fb|Inst|Youtube

UzCSD | Markaziy depozitariy

@uzcsd · Post #2746 · 07.10.2022 г., 13:24

End-of-week depositary statistics OVERVIEW OF SECURITIES ISSUES SAFEKEPT BY THE CENTRAL SECURITIES DEPOSITORY The aggregate number of shares issues totaled 2083, while of corporate bonds totaled 30 as of 07.10.2022. The aggregate volume of issued shares totaled UZS 164 609.8 billion, while of corporate bonds totaled UZS 1 011.4 billion. #issues#shares#bonds#infographics#statistics deponet.uz|Tg|Fb|Inst|Youtube

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