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

Резултати

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

Пребарај: #accountabstraction

当前筛选 #accountabstraction清除筛选
TokenPocket

@tokenpocket_channel · Post #900 · 09.11.2023 г., 07:27

🔥 Create your FIRST AA Smart Wallet on TokenPocket! #AccountAbstraction ✅ No seed phrase worries. ✅ Without Gas concerns. ✅ Easy-to-Use. ✅ Seamless decentralized experience. Tutorial 👉https://tokenpocket-gm.medium.com/create-the-aa-wallet-on-tokenpocket-8132b4ed5d87 Download Your TokenPocket 👉https://www.tokenpocket.pro/ 【Details】https://twitter.com/TokenPocket_TP/status/1722515584640856575 【Powered By】Crypto Box

TokenPocket

@tokenpocket_channel · Post #898 · 07.11.2023 г., 15:10

📣Create the AA Wallet on TokenPocket_TP! 🫡 Ready for the next billion users to join Web3! #AccountAbstraction is one of the best solutions to address the limitations of current EOA wallets, while also bringing more flexibility and operability to the Web3 wallets. 📱TokenPocket Android version now has launched AA Wallet, bringing more Web 3.0 possibilities to crypto users. Here is the tutorial to guide you on how to start your AA journey on #TokenPocket!👇 https://medium.com/@tokenpocket-gm/create-the-aa-wallet-on-tokenpocket-8132b4ed5d87 🔥Ready your TokenPocket AA Wallet! 🚀Ready for the upcoming surprise for TP users! 【Details】https://twitter.com/TokenPocket_TP/status/1721907394614321592 【Powered By】Crypto Box

TokenPocket

@tokenpocket_channel · Post #897 · 07.11.2023 г., 15:09

📣Create the AA Wallet on TokenPocket_TP! 🫡 Ready for the next billion users to join Web3! #AccountAbstraction is one of the best solutions to address the limitations of current EOA wallets, while also bringing more flexibility and operability to the Web3 wallets. 📱TokenPocket Android version now has launched AA Wallet, bringing more Web 3.0 possibilities to crypto users. Here is the tutorial to guide you on how to start your AA journey on #TokenPocket!👇 https://medium.com/@tokenpocket-gm/create-the-aa-wallet-on-tokenpocket-8132b4ed5d87 🔥Ready your TokenPocket AA Wallet! 🚀Ready for the upcoming surprise for TP users! 【Details】https://twitter.com/TokenPocket_TP/status/1721907267526877416 【Powered By】Crypto Box

TokenPocket

@tokenpocket_channel · Post #857 · 20.10.2023 г., 10:18

🚀Bringing the next billion users into Web3! TokenPocket_TP Account Abstraction has offered us a new path for advancement. ❓What is Account Abstraction? ❓How can it transform our Web3 experience? Here's the ultimate beginner's guide to help you grasp and explore Account Abstraction to the fullest.👇👇 #AccountAbstraction#TokenPocket https://tokenpocket-gm.medium.com/account-abstraction-e9cc59a7d6a3 【Details】https://twitter.com/TokenPocket_TP/status/1715310984003555418 【Powered By】Crypto Box

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

TokenPocket

@tokenpocket_channel · Post #896 · 07.11.2023 г., 12:12

🆕We just released TokenPocket’s New Version on Android. 🔺1.8.9🔺 🔵 Support AA Wallet. #AccountAbstraction 🔵 Support #Nostr Protocol on #Bitcoin Network and dogecoin Network. 🔵 Support Unisat’s new signature protocol. 🔵 Modify the signature verification for SuiNetwork. 🔵 Support Malaysian, Danish, and Hungarian. 👉http://tokenpocket.pro #AAWallet#AccountAbstraction#TokenPocket 【Details】https://twitter.com/TokenPocket_TP/status/1721862534695936492 【Powered By】Crypto Box

TokenPocket

@tokenpocket_channel · Post #960 · 02.12.2023 г., 07:30

🆕We just released TokenPocket’s New Version on Android. 🔺1.9.3🔺 1. The Market page supports #MEV Protection. 2. The Market page supports lifiprotocol 3. KeyPalWallet Hardware Wallet supports trondao Sign Message V2. 4. The Transfer page supports domain resolution for associated wallet addresses, including the #BTC Domain, #BTC Inscription Domain, #Eths Inscription Domain, and dotbitHQ domain. 5. Support #Permit transaction resolution. 6. Optimize signature management for trondao MultiSig wallets. 7. Optimize the user experience of AA wallets. #AccountAbstraction 👉http://tokenpocket.pro 【Details】https://twitter.com/TokenPocket_TP/status/1730851266912563295 【Powered By】Crypto Box

Crypto M - Crypto News

@CryptoM · Post #65229 · 12.04.2026 г., 06:24

🚀 Ethereum's Upcoming Glamsterdam Upgrade Progresses Amid Development Challenges Ethereum Foundation has released its latest development update, indicating steady progress in the upcoming Glamsterdam upgrade. According to Foresight News, while the implementation of ePBS (protocol-level PBS) is complex, the related development network is stabilizing, and the block-level access lists (BALs) development network is advancing smoothly. The current goal is to launch the first generalized Glamsterdam development network next week if the ePBS development network remains stable, followed by client releases, security audits, and test network testing. Additionally, EIP-7954, aimed at increasing the maximum contract size, is likely to be prioritized. The subsequent Hegotá upgrade has selected FOCIL (EIP-7805) as the core feature for the consensus layer, while the proposal for account abstraction (AA), EIP-8141, remains in a pending introduction (CFI) status due to lack of consensus. Non-core feature proposals for Hegotá were initiated on April 9. Regarding the network gas limit, the current benchmark target is set at 60 million, with higher limit testing ongoing. As for the upgrade timeline, Glamsterdam is unlikely to go live in the second quarter, and the progress of Hegotá will largely depend on the completion of the former. #Ethereum#Glamsterdam#ePBS#BALs#EIP7954#Hegotá#FOCIL#EIP7805#AccountAbstraction#EIP8141#Blockchain#Crypto#Upgrade#Development#ETH