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

Резултати

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

Пребарај: #gala

当前筛选 #gala清除筛选
Coin Sonar

@CoinSonar · Post #244088 · 18.04.2026 г., 09:00

#GALA | Volume spike (USDT PAIR) 9 times the average volume 200.07K USDT traded in 15 min └Buying vol: 123.38K USDT 🟢 Boost score: 5/10 24h Vol: 1.96M USDT (Binance) Price: 0.00347 (-2.2% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243676 · 17.04.2026 г., 13:27

#GALA | Volume spike (USDT PAIR) 9 times the average volume 197.81K USDT traded in 15 min └Buying vol: 121.37K USDT 🟢 Boost score: 3/10 24h Vol: 1.96M USDT (Binance) Price: 0.00342 (-2.2% in 24h)

Hashtags

Pro Analysis

@proanalysistrader · Post #28387 · 14.01.2025 г., 16:21

#GALA/USDT analysis : #GALA is currently consolidating above the support zone and the 200 EMA. A price bounce is anticipated, allowing for a continuation of its bullish momentum aimed at testing previous highs. Wait for a breakout above the $0.03736 level for a long entry. TF : 1D Entry : $0.03736 Target : $0.06650 SL : $0.02860

Hashtags

Pro Analysis

@proanalysistrader · Post #28314 · 05.12.2024 г., 07:19

#GALA/USDT analysis : #GALA is in an uptrend, forming higher highs and higher lows. After retracing to the 200 EMA and a support zone, the price bounced back and broke the trendline. This suggests a bullish continuation, with expectations to test previous highs. TF : 15min Entry : $0.05933 Target : $0.06655 SL : $0.05497

Hashtags

Pro Analysis

@proanalysistrader · Post #28223 · 18.11.2024 г., 17:48

#GALA/USDT Analysis- After forming a symmetrical triangle pattern, the price broke out, achieving a 30% gain within three days. Currently, the price has completed a retest and is approaching its previous swing high. If it successfully breaks above this level, it has the potential to rally further by over 45%. T.F.- 1-D ENTRY- 0.0317 SL- 0.02720 TARGET- 0.04640 Note: If the stop-loss is triggered before entry, disregard the trade as the price action may develop differently.

Hashtags

Pro Analysis

@proanalysistrader · Post #27987 · 05.10.2024 г., 14:02

#GALA/USDT analysis : #GALA is in an uptrend, making higher highs (HHs) and higher lows (HLs). The price has recently tested the support zone and is expected to bounce back from there to test the previous swing high. TF : 1D Entry : $0.01984 Target : $0.02441 SL : $0.01824

Hashtags

American Crypto©

@americancryptotrading · Post #27573 · 30.03.2026 г., 09:44

🇺🇸#GALA/USDT is trading near the lowerborder of the fallingwedge on the weekly timeframe💁‍♂️ Looks good to buy✈️ American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27552 · 04.03.2026 г., 10:08

🇺🇸#GALA/USDT is facing the lowerborder of the fallingwedge on the weekly chart🧐 Strong upside potential on a bounce🐃 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27512 · 23.01.2026 г., 10:12

🇺🇸#GALA/USDT is holding above the lowerboundary of the fallingwedge pattern on the weekly timeframe💁‍♂️ Strong upside potential on a bounce📈 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27402 · 10.10.2025 г., 08:57

🇺🇸#GALA/USDT is moving inside the descendingtriangle on the weekly chart💁‍♂️ Breakout soon🐃 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27359 · 29.08.2025 г., 09:33

🇺🇸#GALA/USDT is consolidating within the descendingtriangle pattern on the daily timeframe👀 Looks good for the midterm📈 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27302 · 05.07.2025 г., 08:18

🇺🇸#GALA/USDT is facing the supportzone on the weekly timeframe💁‍♂️ Expecting a bounce soon✈️ American Crypto©

Hashtags

123•••56
ПретходнаСтраница 1 од 6Следна