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

Резултати

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

Пребарај: #scams

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

@tonlines · Post #6986 · 30.04.2025 г., 14:21

Tonnel Network: Caution with B-Day Candle Purchases #Tonnel#scams The Tonnel Network warns users about scams involving the purchase of B-Day Candles. It is advised to only buy candles that are mintable, indicated by a blue glow. Source: link @tonlines

News and Tips

@NewsAndTipsNT · Post #3508 · 24.07.2025 г., 15:46

⚠️Dear subscribers, Please don’t fall for cheap tricks. There's been a rise in NFT-related #scams on Telegram lately. If anyone messages you asking to connect certain apps, don’t fall for it , it’s clearly a scam. Never connect your wallet to unknown sources just for the sake of giveaways or so-called "free" #gifts. Remember, nothing is truly free. Also, some channels are using unhealthy giveaway methods to collect user data or trick people into spending money. Think carefully before participating — if you're not comfortable with it, don't spend your money. Here are some safe ways to buy and sell Telegram #NFTs: 1. Buy directly from Telegram: Go to ⚙Settings > 🎁 Buy a Gift. Drops appear randomly, check often and buy when available. You can later upgrade them to NFTs when the option is available. 2. Use Telegram’s built-in buy/sell option: You can trade NFTs securely within the app. ⚙Settings : 🎁Buy a gift : Resale 3. Visit Fragment: A trusted and official platform for buying and selling Telegram collectibles. 4. Use third-party platforms like @Portals/@Tonnel_Network_bot : Reputable web apps can also be used, but make sure they are trustworthy and secure. Stay smart and stay safe!🤝

Venture Village Wall 🦄

@venturevillagewall · Post #4296 · 03.03.2025 г., 16:00

Crypto Fundraising Soars 93.5% in 2024 In 2024, crypto and blockchain startups raised $15.4B, marking a 93.5% increase from 2023. Closed funding rounds reached 1,597, a 45% jump. Early rounds make up 36% of deals. Top VCs include Animoca Brands, OKX Ventures, and MH Ventures. Bitcoin Update: Despite a drop in February, Bitcoin surged 9.3% in March. Currently priced at approximately $91,000. SEC News: SEC drops lawsuit against Kraken, reducing regulatory pressures on the market. US Senate set to vote on IRS rule affecting crypto & DeFi. Scam Alert: Nine residents in Kent, UK lost £1.2M to scammers using personal data to impersonate police. For detailed insights, visit: Alef Aeronautics | Bitcoin Price Update | SEC Lawsuit Info #Crypto#VC#Bitcoin#SEC#Regulation#Tether#USDC#Investments#EarlyStage#Scams#Blockchain#Funding

Venture Village Wall 🦄

@venturevillagewall · Post #3852 · 12.01.2025 г., 01:00

Investigation Reveals Unusual Money Practices An investigation by Rekt News uncovers hardcoded lies and collapsing pegs in the crypto market, with implications that a founder may be manipulating the situation from both sides. Full details in the report: Rekt News #Crypto#Investigation#Finance#MarketTrends#RektNews#LeviathanNews#Blockchain#DeFi#Web3#Trading#Scams

Venture Village Wall 🦄

@venturevillagewall · Post #3894 · 16.01.2025 г., 16:00

Burwick Law Suing Pump.fun Over Losses ⚖️ Burwick Law to file suit against Pump.fun on behalf of investors who lost significant sums in meme coin platform. Legal experts criticize the dominance of scams and speculative assets in crypto. 📊 6.1M tokens launched with total raised nearing $2.3M. More details here. #Crypto#Law#PumpFun#Investors#MemeCoins#Scams#Investments#Litigation#Finance#BurwickLaw

Venture Village Wall 🦄

@venturevillagewall · Post #3938 · 21.01.2025 г., 13:00

Massive USDC Minting and Meme Coin Scam 🚨 50M USDC minted at USDC Treasury, totaling $50.05M. Meanwhile, investors are falling victim to a scam involving fake Trump-related meme coins. Beware of various tokens like BARRON and IVANKA that are misleadingly launched under false pretenses, all funnelling funds to a scam wallet. ⚠️ Over 600 such tokens already spotted! More details here. AI funding news: - Qventus: $85M for AI healthcare ops. - Prophecy.io: $47M for data pipeline solutions. - Gesynta Pharma: $27.27M for new drugs. - Leap Services: $20M for omnichannel retail platform. - NeuroBionics: $5M for advancing neurotech. - Atlantic Sea Farms: $3.80M for sustainable seaweed farming. Find more funding details in the summary! #USDC#Crypto#AI#Funding#MemeCoins#Scams#Healthcare#Data#Pharma#Retail#Neurotech#Seafood#Tech#Investments#Investing#Finance#Blockchain