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

Пребарај: #cryptolaunch

当前筛选 #cryptolaunch清除筛选
Crypto Fight || News 🚀

@cryptofightnews · Post #2542 · 28.02.2025 г., 08:00

New hidden Gem 💎 ClownFi 🤡 Ticker: $Clown A trading token that generate profit. Moon is just a matter of time. Airdrop Pool: 5M $CLOWN 💰 Eligibility: ✅ Follow $CLOWN on X b4 5th Mar @clownfitoken ✅ Join Telegram 👉https://t.me/+R_ZoGK8h9501ZDE1 ✅ RT the pinned tweet & comment your BEP20 wallet address 🔒 Available on PancakeSwap 🔗 SC: 0xc5EB040Ad6C58B4a67d5730E3765365676BbcB67 Website: https://sites.google.com/view/clownfi-token/tokenomics Trades tracker: https://docs.google.com/spreadsheets/d/1SU3gRRl960muulkmhqX2QvzWxK12LjoZ-qIgzif4ios/edit?gid=969882748#gid=969882748 Token Vesting: https://app.uncx.network/lockers/token/chain/56/address/0xc5eb040ad6c58b4a67d5730e3765365676bbcb67 LP Lock: https://app.uncx.network/lockers/manage/lockers-v2?service=edit&locker=0xc765bddb93b0d1c1a88282ba0fa6b2d00e3e0c83&pool=0x7ef43Edf277e0c417a57bF3618B7A50365133841&lock=0&index=0&wallet=0x7E6adB88AE7E55f47cA768A5bEc23f7B83f13AD1&chain=56 🕒 Distribution on 19 Mar—no bots, no dumpers 🚫 #CLOWN#CryptoAirdrop#BNB#CryptoLaunch

🚀 OCRO IEO: Built to Rise, Designed to Reward IEOs are changing the game—and Octario Exchange is leading the way with OCRO. Unlike traditional ICOs, the OCRO IEO is hosted directly on the exchange, offering trust, transparency, and real structure. Powered by the Rising Edge Mechanism, OCRO’s price increases across 3 phases: from $0.30 to $0.80, before launching at $1.00. 📈 Each phase = limited supply + higher price 🎯 Early buyers = best value + built-in scarcity OCRO holders also get real utility: low gas fees, access to blockchain games, and real-world asset exposure. Don’t miss this rare chance to join a token economy engineered to grow. 👉 Participate now at 📢 Let’s talk about the Rising Edge Mechanism that makes OCRO unique: 📈 Upward-Only Pricing You can’t sell OCRO for less than your purchase price. Every sale must occur higher than the last. 🔓 Demand-Driven Supply Every buy unlocks more tokens from escrow, fueling circulation only when there is real demand. ⚡️ Momentum Over Volatility Instead of price drops, market activity creates upward pressure. The more people participate, the stronger OCRO becomes. 💠 This makes OCRO the first token designed to rise by design. 👉octario.exchange #OCRO#IEO#CryptoLaunch#OctarioExchange#BuiltToRise

Crypto Fight || News 🚀

@cryptofightnews · Post #2287 · 18.12.2024 г., 19:45

🚨 THE ICO IS NOW LIVE FOR EVERYONE! 🚨 🔥 The Public Phase Has Officially Begun! 🔥 This is your chance to secure $STAY tokens and join the Web3 travel revolution! Don’t miss out on this groundbreaking opportunity. Why $STAY? 🌍 One Price for All – Fair access for every participant. 📈 Top 3 Exchange Listing Soon – Be ready for the next big thing. 💰 Low FDV at 35M USDT – Strong fundamentals for sustainable growth. 🌟 Jeff Hoffman as Lead Advisor – The visionary behind Booking.com. ⚽ Global Football Ambassador – Uniting sports and travel innovation. 🏨 2.5 Million Onboarded Stays – Endless travel possibilities. 🤝 Official Partner: Huawei – Driving innovation together. Why Act Now? 💎 Double Your Tokens Potential – The time to maximize your gains is now! ⏳ Tokens Are Selling Fast – Don’t miss your chance to be part of the future of travel. 🌐 Grab Your $STAY Now: 👉community.staynex.vip 🎁 Participate in Extra $STAY Rewards: 👉reward.staynex.vip 🔽 Learn More: bit.ly/StaynexICO Risk Disclaimer: Investing in cryptocurrencies involves significant risks. Please understand that your funds are your responsibility. Always Do Your Own Research (DYOR) before making investment decisions. #Staynex#ICO#CryptoLaunch#Web3Travel#BlockchainRevolution#Crypto#STAY#Tokenomics

🚀🚀The intelligent investors💯💯

@the_intelligent_investors · Post #1632 · 01.02.2025 г., 08:34

🚀 Blockchain Energy is LIVE! 🔥 The world’s first physical blockchain product is here—introducing Blockchain Energy! 💥 Our website and ICO are officially LIVE, and early buyers can now purchase BET tokens at. www.blockchainenergy.co.uk. 💰 Buy early before prices increase! Price alerts and community updates will be shared exclusively on our Telegram group – join now: https://t.me/+vLcj22SyWvY2ZDg0 🔗 Powering the future of blockchain with real-world energy! #BlockchainEnergy#BETToken#CryptoLaunch#ICO#BlockchainRevolution#CryptoCommunity#Web3#CryptoInvesting#TokenSale#CryptoPresale

⚪️ 🔤 🔤 🔤 🔤 MEGABASE COIN ($MGBS) The Future of Community-Driven Wealth Starts Now 💰Contract Address: 0x481ef7Ff561d9a2a892553ba930A6365f911E0bb MegaBase ($MGBS) is more than a token — it’s a long-term vision built on transparency, innovation, and community empowerment. We are designing a sustainable ecosystem where growth is shared, value is real, and the community always comes first. 🌍✨ 💥 Why MegaBase? Every $MGBS transaction contributes to something bigger than price action — it helps fuel ecosystem growth and real-world impact. 🔥 Core Features 💰 Earn Rewards 🔥 Auto-Burn Mechanism 🎁 Milestone Giveaways 💧 Auto Liquidity 🛡 Progressive Protection Protocol 🔄 Ecosystem Engineered for Continuous Development ❤️ Charity Contributions Selected by the Community A small percentage of each transaction supports charitable causes, ensuring MegaBase creates global impact alongside financial growth. 💎 Community members will have the opportunity to earn rewards as MegaBase reaches key milestones. This giveaway is our way of saying thank you for believing early and building with us. 🔗 Join the MegaBase Movement ✅Telegram: https://t.me/+IQ696SfodDQwOTEx Twitter: www.x.com/megabasecoin ✅Website: https://megabasecoin.com Let’s build together. Let’s grow together. Let’s succeed together. 💪 #MegaBase#MGBS#Cryptolaunch#LaunchGiveaway#DeFi#Web3#Blockchain#CommunityWealth#Crypto#Base#Coinbase#Bullrun#Bitcoin#Ethereum#DEX#CEX#Bullish

⚡️𝗣𝗮𝗿𝘁𝗻𝗲𝗿𝘀𝗵𝗶𝗽 𝗔𝗻𝗻𝗼𝘂𝗻𝗰𝗲𝗺𝗲𝗻𝘁 ⚡️ ᶜʳʸᵖᵗᵒ ¹⁰⁰ˣ ⱽ ᴹᵃʳˢᵒ ᵒⁿ ᴱᵀᴴ ⁽ ᴮᵃˢᵉ ⁾🔹 Marso Token: The Next BIG Thing in Crypto is Here! 🔥🔥🔥 🚀 The new BIG thing in the crypto market is here: Marso Token is launching, and it’s coming in HOT! Ready to soar, Marso Token is set to redefine possibilities in the crypto universe. 🫡🫡🫡 Join our journey, follow all our socials, stay tuned for the latest updates, and don’t miss your chance to invest early! ⭐️⭐️⭐️⭐️⭐️ 🤑🤑🤑 Get in on the action now—exclusively on BitMart! Let’s make history together with Marso Token. 🥰🥰🥰 🤩🤩🤩🤩 Join the Marso community for exciting news, contests, and more. This is only the beginning, and you’re invited to be part of it. 🤟🤟🤟 ✅Website: marso.tech ✅Telegram: https://t.me/MarsoUniverseCommunity 🚀X: https://x.com/marsouniverse?s=21 📱Instagram: https://www.instagram.com/marsouniverse?igsh=ZjR4cW5vZXVpdmMy&utm_source=qr #MarsoToken#CryptoLaunch#BiggestCrypto#InvestNow#CryptoCommunity#Bitmart#MarsoUniverse#AltcoinSeason#CryptoFuture#BlockchainInnovation#EarlyInvestors#CryptoBuzz#NextBigCoin#FutureOfFinance#MarsoToTheMoon