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

Резултати

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

Пребарај: #acm

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

@CoinSonar · Post #244245 · 18.04.2026 г., 15:22

#ACM | Volume spike (USDT PAIR) 36 times the average volume 128.53K USDT traded in 15 min └Buying vol: 85.31K USDT 🟢 Boost score: 5/10 24h Vol: 339.60K USDT (Binance) Price: 0.461 (-1.7% in 24h)

Hashtags

Pro Analysis

@proanalysistrader · Post #28462 · 10.02.2025 г., 11:36

#ACM/USDT analysis : #ACM is currently in a correction phase and is expected to retrace to test the 200 EMA before resuming its bearish momentum. However, the current level presents a good opportunity for long trade. TF : 4H Entry : $1.075 Target : $1.193 SL : $0.994

Hashtags

Pro Analysis

@proanalysistrader · Post #28359 · 30.12.2024 г., 13:44

#ACM/USDT analysis : #ACM is currently in a downtrend, with the price consistently trading below the 200 exponential moving average (EMA). Recent price action shows a rejection from the 200 EMA, suggesting a continuation of the downward momentum. As a result, it is expected that the price will decline further and test previous lows. TF : 1D Entry : $1.520 Target : $1.235 SL : $1.690

Hashtags

Pro Analysis

@proanalysistrader · Post #28069 · 25.10.2024 г., 12:41

#ACM/USDT analysis : #ACM is in a downtrend, trading below the 200 EMA. The price is currently retracing back to the 200 EMA and a resistance zone, and it is expected to decline from this point, continuing its bearish momentum to test lower levels. It is advisable to wait for a pullback for a short entry. TF : 1H Entry : $1.535 Target : $1.478 SL : $1.567

Hashtags

American Crypto©

@americancryptotrading · Post #27530 · 10.02.2026 г., 10:38

🇺🇸#ACM/USDT is attempting to bounce from the lowerborder of the descendingchannel on the 3D timeframe💁‍♂️ Looking for a rise📈 American Crypto©

Hashtags

Crypto Profit Coach™

@cryptoprofitcoach · Post #7951 · 21.07.2022 г., 15:07

#ACM👈 Call given here Hit 1667 Target 1 done ✅ 14% profit If you invested 1 btc it's now 1.14 btc now 🤑🤑 Signal before pump @ low level Always trade with us for max profit 😊🤑💃 We are best pump tracker 🤑

Hashtags

PT风向旗

@Ptfxq · Post #251 · 15.09.2021 г., 10:35

#ACM ACM 发布公告表示 3 周年以来,其服务器的成本大多数由 SysOP 来承担。由于资金问题,如果在 本月底(2021/09月) 之前筹集不到 1200 欧元将会关闭网站。 除此之外,还移除了捐助者免除 HR 的权限。 感谢 PTfxq 12 号记录员写稿。

Hashtags

PT风向旗

@Ptfxq · Post #517 · 23.12.2023 г., 00:36

#ACM#站免 ACM 五周年,站免两周。 Dear @everyone We are absolutely thrilled to announce that we are celebrating the 5th anniversary of our beloved platform dedicated to the mesmerizing world of Asian cinema! 🥳🍾 It feels like just yesterday that we embarked on this incredible journey, passionate about bringing you the best of Asian cinema. Over the past five years, we've delved deep into the heart of cinematic artistry, exploring the rich tapestry of stories, cultures, and talents that make Asian cinema truly exceptional. One of our core missions has always been to spread our love for Asian cinema around the globe and are very proud of what we have been able to accomplish so far. We've had the privilege of showcasing masterpieces, hidden gems, and emerging talents from across Asia. From the heartwarming dramas to the pulse-pounding action, the thought-provoking indie films to the visually stunning blockbusters, every frame has been a celebration of the cinematic excellence that defines Asian cinema. To mark this momentous occasion, we have activated global FreeLeech (FL) for the next 2 weeks so you can finally download all those films you have bookmarked since our last global FL :). This celebration is not just about looking back but also about looking forward to the exciting cinematic adventures that await us. None of this would have been possible without the unwavering support of our dedicated community. To each and every one of you who has shared their love for Asian cinema, contributed insightful discussions, and made this platform a vibrant hub – THANK YOU! Your enthusiasm fuels our passion, and we are incredibly grateful for your ongoing support. As we raise a virtual toast to the past five years, we eagerly look forward to the next chapter. With your continued support, we are confident that the future holds even more exciting discoveries, cinematic treasures, and shared moments of joy. Thank you for being a part of our cinematic journey. Here's to five years of Asian cinema magic, and to many more to come! Cheers to the love of film! 🎉🎬✨ Yours, AsianCinema Team

Hashtags

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