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 слични објави

Пребарај: #massadoption

当前筛选 #massadoption清除筛选

The number of activated wallets in the TON network has reached 10 million!🚀 Just a year ago, the number of wallets that made at least one transaction was only 687 thousand versus 10 million now, that is, a 14-fold increase over the year! Other interesting metrics on tonstat.com ➡ Transactions per day — 5.4M ➡ Network commission per day — 20k TON ➡ Burnt per day — 10k TON ➡ Mints per day — 50k TON If you look closely at the last three metrics, the year when the community voted to burn 50% of commissions, these indicators differed hundreds of times but now have the same order of magnitude, which has a positive effect on the $TON rate. We continue to monitor the development of The Open Network!❤️#massadoption#web3#crypto ⚡️Boost | 🎞YouTube |🌐Twitter

🚀Telegram is the driving force behind the mass adoption of cryptocurrencies Since its launch, Telegram has become not just a messenger, but a key element in the world of cryptocurrencies. A recent article on Coindesk looks at exactly how Telegram is driving #massadoption of cryptocurrencies and why this has huge implications for the entire industry.🌐 Telegram, with its powerful ecosystem of channels, bots and groups, has become the ideal platform for communicating and spreading information about cryptocurrencies. Hundreds of thousands of users discuss new projects here every day, share knowledge and experience. Integration with cryptocurrency services and the creation of convenient tools for users make #Telegram not just a convenient messenger, but a real hub for crypto enthusiasts (check the Telegram App Center). Particular attention in the article is paid to #TON (The Open Network) — Telegram’s own blockchain platform, which opens up new horizons for the integration of cryptocurrencies into everyday life. TON already offers users unique opportunities for transactions with digital assets, and its potential continues to grow. Telegram is not just an intermediary, but an active participant in the process of accepting cryptocurrencies, offering convenient and accessible solutions for both beginners and experienced users. This makes Telegram one of the most significant platforms for the development and popularization of cryptocurrencies around the world. Original: Telegram Is Crypto's Adoption Machine #Crypto#Telegram#TON

UXLINK

@uxlink_community · Post #371 · 28.03.2025 г., 03:19

🚀 Exciting updates: UXLINK One account growth has exploded from 160K to 500,000+ in under 10 days! 💥 💰 Over 6,000,000 $UXLINK deposited as OAOG protocol’s universal gas 📈 Daily transactions: 10,000+ | Total transactions: ~1,000,000 This is what global community power looks like! 🌍✨ Thank you for trusting us to redefine #Web3. Chain & account abstraction are revolutionizing user experiences—smoother, safer, and simpler for everyone. As the world’s largest #Web3 social platform & infrastructure, we’re building the SOCIAL FOUNDATION for mass adoption. 💪The future is here—let’s shape it together! 🎉#UXLINK#MassAdoption#Web3Infrastructure#AccountAbstraction

Venture Village Wall 🦄

@venturevillagewall · Post #4253 · 26.02.2025 г., 16:00

Avalanche Visa Card Launches Today Avalanche has officially launched its Visa card to promote cryptocurrency adoption. The card allows users to spend crypto easily in daily transactions, integrating DeFi solutions. This move aims to bridge the gap between traditional finance and the digital currency landscape, enhancing user accessibility to crypto assets. Read more here. #Avalanche#Crypto#DeFi#Visa#Blockchain#Finance#MassAdoption#Payments#DigitalCurrency

📱Pay for Daily Expenses with Crypto — RedotPay & 💎TON! #Massadoption just got another leg up thanks to RedotPay’s integration with the TON Blockchain. TON users can now spend $USDT-TON directly via the #RedotPay App or Card, compatible with Google Pay, Apple Pay, and Alipay, unlocking payments at over 🔗 130 million merchants worldwide, including #Starbucks and #Amazon. 🔥Exclusive Perks for TON Users: for a limited time, get discounts, cashback rewards and $5 bonus! ⬇️Download the RedotPay 💵 Get FREE $5 bonus on your wallet via promo code: j05mm

Why collect SBT and XP from🙏TON Society? Let us remind you that SBT (Soulbound Token) is an NFT that is tied to your wallet, it cannot be traded or sold, which makes your wallet unique if it stores SBT NFT. What is it for? SBT NFT is a kind of “identity confirmation”, but only anonymous. SBT makes it clear to the sender that he is dealing with the right recipient and the right person behind him. Including when it comes to awards for contributions to the development of The Open Network. Such rewards can be obtained for activities within the Open League, they are displayed in your TON Society profile. What will SBT and XP owners get? Already, many people are collecting these achievements expecting to receive a reward in the future, but few people know how it works and what they can count on. ❤️Open League and SBT • SBTs are issued (minted) by the TON Society for contributions to the development of the TON blockchain community - for example, for participating in competitions and attending AMA sessions, attending conferences and meetups. • SBTs are issued by projects that receive incentives and grants through the Open League. 🫰Experience Points (XP) will become reputation points and will be converted into $TON • XP points at a 1:1 ratio to $TON , can be exchanged for $TON at any time. • Time-based formula affects the exchange rate - if $XP tokens are redeemed before March 31, 2025, the conversion will be at a less favorable rate. • On March 31, 2025, 1 XP will be equal to 1 $TON • SBT assumes a constant increase in XP income for inviting friends, purchasing Telegram Premium or TON DNS. 🔝TON Society will become the new public profile of the TON member, recognizing and rewarding everyone's achievements and contributions. #TON#Toncoin#TheOpenLeague#MassAdoption#TONSociety#TONDNS#SBT#NFT ⚡️Boost | 🎞YouTube |🌐Twitter