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

Резултати

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

Пребарај: #nothingphone2

当前筛选 #nothingphone2清除筛选
Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #725 · 25.03.2026 г., 22:34

Derpfest - Official | Android 16 QPR2| Nothing Phone 2 ✍️ Details: - Codename: #Pong - Released: 26-03-2026 🔽 Download : Here | Mirror ✨ Changelogs: Here 🆘 Support: Here 📸 Screenshots: Here 💰 Donate: Here | Here 🏷 Tags : #ROM#AOSP#Official#Derpfest#NothingPhone2 ✍️ Notes: • Gapps is included. Do NOT flash again. • Latest base firmware is recommended. • If you face any bugs, report with logs. • NTcamera and dolby support available. • KSU included 🏆 Credits: - DerpFest Team - Testers who helped all throughout - @genoxci for the banner! -@AgarwalGovind for the build server! 👤 Maintainers: @NeiKos4962 🔔 Updates: @NothingPhone2Updates 💬 Chat: @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #709 · 01.02.2026 г., 00:01

Derpfest - Official | Android 16 QPR2| Nothing Phone 2 ✍️ Details: - Codename: #Pong - Released: 01-02-2026 🔽 Download : Here ✨ Changelogs: Here 🆘 Support: Here 📸 Screenshots: Here 💰 Donate: Here | Here 🏷 Tags : #ROM#AOSP#Official#Derpfest#NothingPhone2 ✍️ Notes: • Gapps is included. Do NOT flash again. • Latest base firmware is recommended. • If you face any bugs, report with logs. • NTcamera and dolby support available. • KSU-Next with SuSFS included • CLEAN FLASH MANDATORY 🏆 Credits: - DerpFest Team - Testers who helped all throughout - @genoxci for the banner! 👤 Maintainers: @NeiKos4962 🔔 Updates: @NothingPhone2Updates 💬 Chat: @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #684 · 19.10.2025 г., 13:25

Derpfest - Official | Android 16| Nothing Phone 2 ✍️ Details: - Codename: #Pong - Released: 19-10-2025 🔽 Download : Here | Mirror ✨ Changelogs: Here 🆘 Support: Here 📸 Screenshots: Here 💰 Donate: Here | Here 🏷 Tags : #ROM#AOSP#Official#Derpfest#NothingPhone2 ✍️ Notes: • Gapps is included. Do NOT flash again. • Latest base firmware is recommended. • If you face any bugs, report with logs. • NTcamera and dolby support available. • KSU-Next with SuSFS included 🏆 Credits: - DerpFest Team - Testers who helped all throughout - @genoxci for the banner! 👤 Maintainers: @NeiKos4962 🔔 Updates: @NothingPhone2Updates 💬 Chat: @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #673 · 17.09.2025 г., 21:28

Derpfest - Official | Android 16| Nothing Phone 2 ✍️ Details: - Codename: #Pong - Released: 18-09-2025 🔽 Download : Here | Mirror ✨ Changelogs: Here 🆘 Support: Here 📸 Screenshots: Here 💰 Donate: Here | Here 🏷 Tags : #ROM#AOSP#Official#Derpfest#NothingPhone2 ✍️ Notes: • Gapps is included. Do NOT flash again. • Latest base firmware is recommended. • If you face any bugs, report with logs. • NTcamera and dolby support available. • KSU-Next with SuSFS included 🏆 Credits: - DerpFest Team - Testers who helped all throughout - @genoxci for the banner! 👤 Maintainers: @NeiKos4962 🔔 Updates: @NothingPhone2Updates 💬 Chat: @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #464 · 28.10.2024 г., 18:21

NothingMuchROM | Android 14 | Nothing Phone (2) Nothing OS with some handful modifications for a better experience ✍️ Details: - Version: r18 - Codename: #Pong - Released: 28/10/24 🔽 Download : Here 🆘 Support group: Here ⚙️ Installation: Here 💵 Donate: Buy this app 🔖Tags : #Stock#ROM#arter97#U#NothingPhone2 ✨Changelogs: - Stable release based on NOS 2.6 (Pong_U2.6-241016-1700) 😎 Developer: @arter97 🔔 Updates: @NothingPhone2Updates 💬 Chat: @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #421 · 04.09.2024 г., 14:36

NothingMuchROM | Android 14 | Nothing Phone (2) Nothing OS with some handful modifications for a better experience ✍️ Details: - Version: r16 -> r17 - Codename: #Pong - Released: 15/10/24 🔽 Download : Here 🆘 Support group: Here ⚙️ Installation: Here 💵 Donate: Buy this app 🔖Tags : #Stock#ROM#arter97#U#NothingPhone2 ✨Changelogs: r16: Stable release based on NOS 2.6 [Pong_U2.6-240828-1751_2.6] r17 Custom bionic updated: Updated jemalloc to 6cc4217 (Sept 2024) Updated arm-optimized-routine to 3389879 (Oct 2024) 😎 Developer: @arter97 🔔 Updates: @NothingPhone2Updates 💬 Chat: @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #344 · 08.07.2024 г., 14:53

NothingMuchROM | Android 14 | Nothing Phone (2) Nothing OS with some handful modifications for a better experience ✍️ Details: - Version: r15 (NOS 2.6.0) - Codename: #Pong - Released: 08/07/24 🔽 Download : Here 🆘 Support group: TG | XDA ⚙️ Installation: Here 🔖Tags : #Stock#ROM#arter97#U#NothingPhone2 ✨Changelogs: - Stable release based on 2.6.0 - Custom bionic updated to use the latest AOSP compiler and fix several minor issues in the math library. 😎 Developer: @arter97 🔔 Updates: @NothingPhone2Updates 💬 Chat: @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #337 · 02.07.2024 г., 11:41

NothingMuchROM | Android 14 | Nothing Phone (2) Nothing OS with some handful modifications for a better experience ✍️ Details: - Version: r14 (NOS 2.5.6) - Codename: #Pong - Released: 02/07/24 🔽 Download : Here 🆘 Support group: TG | XDA ⚙️ Installation: Here 🔖Tags : #Stock#ROM#arter97#U#NothingPhone2 ✨Changelogs: - Stable release based on NOS 2.5.6 - Dirac is back, thanks to the fix from gotenksIN ✍️ Note: - If you don't want dirac, stick to the r13 build based on NOS 2.5.6 😎 Developer: @arter97 🔔 Updates: @NothingPhone2Updates 💬 Chat: @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #352 · 14.07.2024 г., 05:23

Meteoric Kernel | Android 14 | Nothing Phone (2) ✍️Details - Version: r4.2 - Codename: #Pong - Released: 14/07/24 🔽Download: [ Normal | KSU ] Version 🆘Support Threads: TG 🎄Source: Here 🔖Tags: #Meteoric#Kernel#U#NothingPhone2 ✨Changelogs - Lockscreen does not dim now when user is using hbm. - Optimize fingerprint on custom roms. - Fix compatibility with AOSPA. ✍️Note - Report issues (if any) with logs in the support group or comment section below. - You can revert back to stock kernel (state) by flashing stock boot, vendor_boot and dtbo image - This kernel is compatible with both NOS & custom ROM(s) 😎Dev: @HELLBOY017 🔔Updates: @NothingPhone2Updates 💬Chat: @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #338 · 03.07.2024 г., 08:07

Meteoric Kernel | Android 14 | Nothing Phone (2) ✍️Details - Version: r4.1 - Codename: #Pong - Released: 03/07/24 🔽Download: [ Normal | KSU ] Version 🆘Support Threads: TG 🎄Source: Here 🔖Tags: #Meteoric#Kernel#U#NothingPhone2 ✨Changelogs - Fix cpu_input_boost driver not detecting idle state (Improves battery drain) - Thermal driver optimizations from motorola - Fingerprint improvement for custom roms - Switch back to qcom-lpm idle governor - Merged latest clo tags and sync with android12-5.10-lts - Reconfigure cpu_input_boost freqs - Fix kcal not applying - Fix crashdump caused due to gpu not waking up ✍️Note - Report issues (if any) with logs in the support group or comment section below. - You can revert back to stock kernel (state) by flashing stock boot, vendor_boot and dtbo image - This kernel is compatible with both NOS & custom ROM(s) 😎Dev: @HELLBOY017 🔔Updates: @NothingPhone2Updates 💬Chat: @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #644 · 28.06.2025 г., 12:45

Lunaris OS | CLO | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 2.13 - Released: 28/06/25 🔽 Download: Here 🆘 Support : TG ⚙️ Installation: Here 📓 Kernel: Here 📸 Screenshots : Here 🔩 Beta builds : Here 💰 Donation: BMC | steinsgate007@axl ❗️ Tags : #ROM#CLO#V#LunarisOS#NothingPhone2 ✍️ Note: - Recommended to use this kernel - Dolby and nothing camera support available - Latest nothing firmware required - Found bugs! Report in group with proper logs 🔖 Changelog - Merged System LA.QSSI.15.0.r1-16100 (June Patch) - Add Per-app refresh rate selector - Add keybox spoofing (Thanks to HELLBOY017) - Add LMO SystemClocks - Forcefully enable hotspot speed settings - Add support for omni statusbar weather logo - Improvements to performance and system stability 🏆 Credits: - Nothing Phone 2 community for their support - All testers and beta users - For source and features AOSPA team, axionAOSP, risingOS, TenXOS etc 😎 Maintainer : @Ghosutox 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #623 · 25.05.2025 г., 04:37

Lunaris OS | Radahn - CLO | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 2.12 - Released: 25/05/25 🔽 Download: Recovery | Fastboot | Mirror 🆘 Support : TG ⚙️ Installation: Here 📓 Kernel: Here 📸 Screenshots : Here 🔩 Beta builds : Here 💰 Donation: BMC | steinsgate007@axl ❗️ Tags : #ROM#CLO#V#LunarisOS#NothingPhone2 ✍️ Note: - Recommended to use this kernel - Latest nothing firmware required - Found bugs! Report in group with proper logs 🔖 Changelog - Add back NOS camera sepolicy - Merged System LA.QSSI.15.0.r1-15600-qssi.0 - Configurable Nothing OS inspired doze animation - Add experimental SDK 32 play store spoof switch for integrity - Switch to adreno-t drivers - Some bugs and NPE fixes - Improvements to performance and system stability 🏆 Credits: - Nothing Phone 2 community for their support - All testers and beta users - For source and features AOSPA team, axionAOSP, risingOS, TenXOS etc 😎 Maintainer : @Ghosutox 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

123•••10•••1314
ПретходнаСтраница 1 од 14Следна