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

Резултати

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

Пребарај: #scalping

当前筛选 #scalping清除筛选
Daily Channels

@dailychannels · Post #6163 · 27.06.2025 г., 13:00

Channel: GOLD SCALPING TRADING SIGNALS Members: ~4.4K 💢 Username: @gold_scalping_tradings Description: We are the best in Day trading and SCALPING. Contact our admin for your investment and copy trading @Gold_scalping_admin 🏷 Tags: #crypto_fx_trading #gold#forex#trading#scalping#signals https://telegramchannels.me/channels/gold_scalping_tradings

Daily Channels

@dailychannels · Post #6458 · 03.11.2025 г., 13:00

Channel: Robert Croak GOLD SIGNALS Members: ~5.01K 💢 Username: @robertcroakgoldsignals Description: Robert Croak Gold Signals™ – VIP Trading Alerts Get daily premium Gold, Crypto & Forex trading signals with high win rate. Free + VIP alerts | Real-time analysis | 90%+ accuracy Contact me for your investment - @Robert_croaks 🏷 Tags: #crypto_fx_trading #gold#trading#forex#investment#scalping https://telegramchannels.me/channels/robertcroakgoldsignals

Daily Channels

@dailychannels · Post #6135 · 13.06.2025 г., 13:00

Channel: Scalping_300% Members: ~51.42K 💢 Username: @scalping_300 Description: 100% FREE 300% daily profit guarantee With 98% Accuracy 10-30 Signal Daily, Cornix Support. 🏷 Tags: #crypto_fx_trading #scalping#trading#free#cryptocurrency#profit https://telegramchannels.me/channels/scalping_300

Daily Channels

@dailychannels · Post #6425 · 20.10.2025 г., 01:00

Group: Pip Pro Trader Fx Members: ~2.68K 💢 Username: @pip_pro_traderfx Description: Learn Forex trading with real-time signals. Master gold trading, day trading, and scalping with expert strategies and daily motivation. Join our community and start your journey to financial freedom 🏷 Tags: #crypto_fx_trading #forex_trading#day_trading#scalping#forex_signals#gold_signals https://telegramchannels.me/groups/pip_pro_traderfx

🪙$STORM Token: Rising Success in the Market A week after the listing, the $STORM token draws an upward curve on the chart. Let's try to figure out what the growth is connected with and what awaits us in the near future. Let us remind you that Storm Trade— is not just another trading platform, they are pioneers setting trends in the world of decentralized finance, providing a unique trading experience on the largest derivatives #DEX on the #TON network. Roadmap and development of Storm Trade ⚡️Storm Trade V2 Adding new pairs and trading instruments such as commodities ( #crudeoil, #gold etc.) and currencies (#Forex) will open doors to new markets, increasing your ability to diversify your trading strategies. ⚡️ Significant reduction in time to open positions, fixed closing price and guaranteed execution of SL/TP orders will make the trading experience precise and efficient. The next versions of the protocol (V3 and beyond) will feature 1-click trading and gas-free trading. This will make your trading not only efficient but also accessible, lowering entry barriers for beginners. 🏆SocialFi and Copy Trading Trading doesn't have to be boring. With the introduction of copy trading, you will be able to not only trade, but also follow the best traders, copying their successful strategies. Leaderboards of the strongest will encourage traders to compete, achieving better results, and the functions for creating teams (squads) will help find like-minded people and trade together. 🔮Leveraged Prediction Markets Traders will be able to bet on the outcomes of various events, including economic indicators and sports results, with the possibility of using leverage. This will increase potential profits while minimizing investments and will attract the attention of not only cryptocurrency traders, but also those who want to speculate on real events. 📈Options, Spot Trading and Limit Orders The introduction of options will allow users to apply more flexible and advanced strategies. The ability to hed and work with volatility will be an important addition to the main trading instruments, attracting experienced traders. Limit orders will allow traders to use more complex strategies such as #scalping or grid orders, which can be profitable in conditions of high market volatility. #StormTrade will provide users with tools to automate such strategies, making them more efficient. 🪄AI Trading Artificial Intelligence in Action The team began experimenting with the use of artificial intelligence developed by partners to participate in a hackathon, and conducted the first experience of implementing #AI in Storm Trade. The built-in AI proved itself to be effective, helping to find optimal entry and exit points, predict market movements, and minimize risks. The full list of tools planned for implementation can be found here: 🔗Read the article StormTrade | Bot | Chat | Channel