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

Резултати

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

Пребарај: #sebi

当前筛选 #sebi清除筛选
PRICE ACTION EXPERT

@priceactionexpert · Post #7683 · 11.08.2024 г., 13:01

https://x.com/priceactiongann/status/1822618789969555956 #stocks#Adani Next week Time is up! next 7 weeks will be crucial for sure. Numbers 84,42,21 all vibrates Change occurs when square numbers coincide like 9x9 square and 84 (12x7) 81 to 84 major change of Time! 7x7 square 12x12 square 81,12,21,42 etc. From starting week to top is 845 to 849 weeks from where it dropped 840 and 84 all same. 84/2=42/2=21. Range of the Points drop last time: 22x144= (3168) 3172! Drop lasted 7 weeks and next 7 weeks x 7 weeks 70 weeks and 42 weeks we had nice High and Low! #hinderburg (From Tuesday, 24 January 2023 to Saturday, 10 August 2024 , 564 days or 80 to 81 weeks) lot more hinted u can check and find out! #StockMarket#SEBIChairperson#SEBI#StockMarketNews#MadhviPuriBuch https://x.com/priceactiongann/status/1822618789969555956

PRICE ACTION EXPERT

@priceactionexpert · Post #7795 · 04.10.2024 г., 10:13

https://x.com/priceactiongann/status/1842145244281815243 #stockmarket#nifty#banknifty Common Myths about Fundamentals Amongst Investors and Traders: 1.only one direction focused that "Market moves only one direction upside" in stocks or indices (based on stats and economy, etc, it's wrong ) 2. News sometimes acts as a force of volatility, but real movements are done and can be seen much ahead Years, Months and Weeks ahead. 3.Technical Analysis rules without a doubt, nothing to do with news, or war or SEBI meetings There were many SEBI meeting and Iran war, or Russian war started before but it dint affect much. If it's affecting now, it's definitely technical reason and Cycles. 3.if u want to understand and be safer and survive long term in markets study cycles (even the election drop was 23535 price in gift nifty was technical only) its based on natural law which markets cannot evade. 4.Fundamentals can be used as extra but not that alone is the reason, it is a catalyst to move price faster or more volatility, (Technical alone or cycles alone can be used to find price and time and long direction movement also) 5.I just use levels and calculations cycles only, if u are real trader u would know without price, fundamentals cannot help in these. If time is known, it can help us better too. 5.Ignorance and if they don't know the reason, they would say its coz of recent event and connect with it. its not really the case in most scenarios 6.Even every stock has its own individual vibration cycles and at certain times it should correct and drop, and some might crash massive too 7.Focusing on short term and ignoring massive long-term cycles, short term might look like good for scalpers but when massive cycle hits there will be huge volatility, and all will be wiped out in a single day. Learn More and be Focused! See the Proof, Results and Evidence and don't follow blindly anything! #trading#nifty#priceaction#stocks#stock#gann#stockmarketcrash#niftycrash#sebi https://x.com/priceactiongann/status/1842145244281815243