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

Пребарај: #tmonk

当前筛选 #tmonk清除筛选
TMONK Announcements

@tmonkannouncements · Post #262 · 22.08.2025 г., 11:23

#TMONK (TON) 💎 Telegram Monk is a meme? Not only this but something greater it's a meme with a bold and ambitious vision inspired by Pavel Durov, because Durov is also a @monk. This is a CTO, the guys on the team are working hard to prepare us for something insane. The team is rebranding the entire site, logos, profiles. 📱 Telegram: https://t.me/Tg_Monk 📱: https://x.com/TmonkMonk 📱 NEW WEBSITE: SOON 👍 Ca: EQBikuxOnMkU4XNSVGQCbg46lk5d8vuhzDQtcDOJOcjaIvkV 😄Chart: https://dexscreener.com/ton/EQBikuxOnMkU4XNSVGQCbg46lk5d8vuhzDQtcDOJOcjaIvkVb

Hashtags

TMONK Announcements

@tmonkannouncements · Post #35 · 01.04.2024 г., 21:05

✅TMONK DAILY TASK ✅ 1️⃣ Join on: https://moontok.io/coins/telegram-monk , add TMONK on watchlist ⭐️ and vote 🚀. 2️⃣Join on: https://ntm.ai/token/EQBikuxOnMkU4XNSVGQCbg46lk5d8vuhzDQtcDOJOcjaIvkV?graph=EQDOfAMeJVkC1Q0F1SofSqKf4YLxaj41YumJ4tnER7RTH_GH and vote TMONK 🚀. 3️⃣Join on:https://www.geckoterminal.com/ton/pools/EQDOfAMeJVkC1Q0F1SofSqKf4YLxaj41YumJ4tnER7RTH_GH , add TMONK to Watchlist ⭐️ and vote 🚀. 4️⃣Join in X: write #TMONK in the search bar, click latest and leave a like, a comment and a repost. 5️⃣ Invite all your friends to join our project. TG: https://t.me/Tg_Monk X: @TMonkOfficial X-partnership: @TMonkPartners. 6️⃣ Participate in all raids. We will go viral, we will become a point of reference in the TON ecosystem, you are incredible, you are unique, we will achieve unimaginable goals. We are TMONK.

Hashtags

TMONK Announcements

@tmonkannouncements · Post #195 · 11.06.2024 г., 07:11

Special competition and giveaway for our NFT holders 🔥Earn Rewards for Social Media Tasks📲 🔗dexpert.io/activity 📆 2024/06/12 ~2024/06/18 Connect your wallet to start. Points System: 📌Benefits for NFT Holders: Golden Pass(Unlimited bot usage up to 6 months), 8000 D-points in the first missions, and 1500 D-points everyday! 📌Other Users: 2000 D-points in the first missions, and 600 D-points per wallet per day. ⁉What can D-point do? Our Official link: linktr.ee/dexpert Token Creation Bot: t.me/DexpertThorBot Sniper Bot: t.me/DexpertOdinBot #dexpert#Tmonk

TMONK Announcements

@tmonkannouncements · Post #15 · 25.03.2024 г., 22:54

Announcing Partnership the $TMONK • After a while, #TMONK is a good team, They have a strategy for long-term development on #TON • #DashApe Will work and develop with the team, the team's goal is at the lowest level of 5M, there are many more features to be released soon • You can feel free to buy $TMONK now, as they will soon reach 500K this month • Mc 45k is low now, Buy and hold for long term TG : https://t.me/Tg_Monk Chart : https://www.geckoterminal.com/ton/pools/EQDOfAMeJVkC1Q0F1SofSqKf4YLxaj41YumJ4tnER7RTH_GH

TMONK Announcements

@tmonkannouncements · Post #46 · 10.04.2024 г., 14:14

Hello all new Monks! Welcome to #TMONK❔ The only place on TON where #memecoin#charity and #crowdfunding coexist! Where you can see realized the principles and ideas of Durov and Telegram 💎🔥 Be sure to read the pinned messages at the top ❔❔ However, If you're new to #TON Blockchain, feel free to ask all you need! Stay tuned! WE ARE CREATING AN ECOSYSTEM ❔ Follow both our X account❔ @TMonkOfficial @TMonkPartners ❔Follow and comment each post in our channels❔ ❔https://www.tgmonk.org/project/ ❔https://t.me/TmonkAnnouncements ❔https://t.me/AthenaMemeHubChat ❔https://t.me/AthenaDexFi_en ❔https://t.me/AthenaMemeHub ❔https://t.me/bestcoins_club ❔https://t.me/CryptoSharingHub TMONK Team.

TMONK Announcements

@tmonkannouncements · Post #113 · 21.04.2024 г., 15:02

💎$TMONK #RoadToMEMELANDIA# Contest💎 1️⃣st 100 token $TMONK 2️⃣st 70 token $TMONK 3️⃣st 30 token $TMONK 👀5 more participants will get WL spot in upcoming private sale of our partner ATHENA DexFI How to enter the #contest : 1️⃣Follow @ https://x.com/TMonkPartners?s=35 2️⃣ Join telegram groups: ✔️https://t.me/RoadToMEMELANDIA ✔️ https://t.me/TmonkAnnouncements 3️⃣ Under the tweet of this contest present on X https://x.com/TMonkPartners?s=35 Answer with a post with original and funny TMONK memes ( Video, gif or stickers are welcome as well ) You can create as many as you want . Share your post to atleast 3 real yours friends(we will check if you don’t respect this rule or share to someone that isn t your friend) Remember to put also @ton_blockchain and @telegram and to use hashtags #MemeContest#freedom#crowdfunding#charity#tmonk 4️⃣. Submit your X entry under the comments of relatived post of this two groups 🖥https://t.me/RoadToMEMELANDIA 🖥 https://t.me/TmonkAnnouncements The 8️⃣ winners will be chosen by the team Valid for 4️⃣ days Ends 25.04.2024 15 utc UTC GOOD LUCK TMONKERS

TMONK Announcements

@tmonkannouncements · Post #402 · 07.10.2025 г., 19:50

🤝 $TON UNIQUE: TMONK x $GROYPER Nr. 1! 🐸💎 ​ ​The partnership that celebrates uniqueness is here! TMONK the GROYPER are joining forces! ​Two powerful brands, one dominating narrative. Growth on TON has never been this #Bullish and unmistakable. ​Join the Uniqueness: ​MONK: 💬Tg_Monk tmonk-ton.com https://dexscreener.com/ton/eqdofamejvkc1q0f1sofsqkf4ylxaj41yumj4tner7rth_gh ​GROYPER 🐦@groyp_on_ton 💬GroyperonTon https://dexscreener.com/ton/EQDPtuvcV-lq_i3aYT9ZCEOKIj4EwcrnsBJjMJmQpehBeSPD ​#TMONK#VYNX#Groyper#TON#Nr1 ​

TMONK Announcements

@tmonkannouncements · Post #320 · 02.10.2025 г., 07:33

American $IDIOT × $TMONK Digital Creation Contest 🚨 Two legendary TON meme coins — $IDIOT & $TMONK — unite to launch a contest for all artists, meme-makers, designers and animators. Your task: create digital art or short videos inspired by the words of Pavel Durov. 🎭 Themes (choose one or mix them): ✨#LeadByExample → Show discipline through actions, not words. ✨#FocusOnThePositive → Spread strength & positivity, even in hard times. ✨#PrioritizeConscience → Highlight morals and conscience as timeless values. 🖌 Creative Direction: – Any medium: illustration, animation, photo art, 3D, short video. – Include $IDIOT & $TMONK in your work (graffiti, sticker, cameo, clothing, etc.). – Be creative, original, and make it memorable. 🏆 Prize for 1 Grand Winner: 🎩 TOP HAT — Uncle Sam (Telegram gift from American $IDIOT) 📖 Special e-book created by the TMONK community 📌 How to Enter: Post your creation under this official post and Tag @TmonkMonk & @AIdiot4547. Share also in: ▪️t.me/Tg_Monk ▪️t.me/AmericanIdiotBackup ⏳ Timeline: – Submission deadline: 10.10.2025 (Pavel Durov’s birthday) – Winner announced: 11.10.2025 ⚖️ Judging (100 points total): – 50 pts → Community score (likes, tags & shares on X) – 50 pts → Jury score (5 judges) on: • Creativity & originality • Connection to theme • Clever inclusion of $IDIOT & $TMONK 👉 Show your vision. Spread Monk values. Leave your mark. #LeadByExample#FocusOnThePositive#PrioritizeConscience #TON#TMONK#IDIOT