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

Резултати

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

Пребарај: #javascript

当前筛选 #javascript清除筛选
GitHub Trends

@githubtrending · Post #15624 · 16.04.2026 г., 12:30

#javascript Evolver is a free MIT-licensed Node.js tool (needs Git and Node >=18) that analyzes AI agent logs in your memory folder, picks the best evolution genes, and generates secure GEP prompts to fix errors or improve prompts automatically. Clone the repo, run `npm install` then `node index.js` (or `--loop` for continuous mode), and it works offline or connects to evomap.ai for shared skills and leaderboards. This benefits you by turning random prompt fixes into reusable, traceable assets that make your AI agents more reliable, stable, and evolvable without manual tweaks or code changes. https://github.com/EvoMap/evolver

Hashtags

GitHub Trends

@githubtrending · Post #15591 · 28.03.2026 г., 11:30

#javascript foobox is a sleek, customizable skin for foobar2000 music player that uses JSplitter for smooth layouts, lyrics, spectrum analyzer, playlists, covers, search, and online radio. Download the free Chinese version package from latest Releases—it works on 32/64-bit, installs green without the base app, and lets you switch layouts via Main Menu > View > Layout > Quick Setup. You get a modern, feature-rich interface that runs fast, giving full control over your music library for better listening. https://github.com/dream7180/foobox-cn

Hashtags

GitHub Trends

@githubtrending · Post #15589 · 27.03.2026 г., 10:30

#javascript Figma MCP server connects your Figma designs to AI coding tools in VS Code, Cursor, Claude, and more, letting agents pull variables, components, and layouts to generate precise code from selected frames. You can write to Figma canvases, search design systems, and use Code Connect for codebase consistency. This speeds up design-to-code workflows, ensures UI matches designs exactly using your tokens, and cuts errors for faster, reliable app building. https://github.com/figma/mcp-server-guide

Hashtags

GitHub Trends

@githubtrending · Post #15548 · 08.03.2026 г., 11:30

#javascript Impeccable is a frontend-design skill with 17 commands like /audit, /critique, /polish, and /animate, plus anti-patterns to avoid generic AI mistakes such as overused fonts or gray text on colors. Download bundles from impeccable.style for tools like Cursor or Claude Code to create polished UIs for pages, dashboards, or apps. It benefits you by speeding up development, ensuring consistent, accessible, high-quality designs that stand out and save time on fixes. https://github.com/pbakaus/impeccable

Hashtags

GitHub Trends

@githubtrending · Post #15323 · 09.12.2025 г., 13:00

#javascript Claude-Mem is a tool that helps Claude Code remember everything important from your past sessions by automatically saving and compressing what you do. This means you don’t have to repeat explanations or lose track of your project history, saving you time and effort. It offers smart search to quickly find past work, a web viewer to see memory in real time, and privacy controls to keep sensitive info safe. It also supports long projects by compressing data to avoid running out of memory. This makes your AI assistant a continuous, helpful partner that keeps your work connected across sessions. https://github.com/thedotmack/claude-mem

Hashtags

GitHub Trends

@githubtrending · Post #15197 · 04.10.2025 г., 12:30

#javascript You can create and submit an adapter to DefiLlama by following their guide and submitting a pull request (PR) with "Allow edits by maintainers" enabled. Adapters collect blockchain data to calculate metrics like TVL (Total Value Locked), which must be based on blockchain data for accuracy. After merging, your adapter may take time to appear on the UI. For volume or liquidation adapters, submit PRs to specific repositories. Avoid editing certain files like `package-lock.json`. You can test adapters locally and change RPC providers via environment variables. DefiLlama supports contributors with Discord help and aims for transparency and accuracy in DeFi data. This process helps you list your DeFi project and share reliable data with the community. https://github.com/DefiLlama/DefiLlama-Adapters

Hashtags

GitHub Trends

@githubtrending · Post #15195 · 04.10.2025 г., 11:30

#javascript You can watch live MLB baseball games right in your computer’s terminal using a tool called Playball. It shows game schedules, scores, and play-by-play action in a simple text interface, so you can follow games quietly without needing video. You can install it easily with one command and customize colors and favorite teams to make it easier to see what matters most to you. This is great if you want to keep up with baseball discreetly or on a low-resource device without streaming video, making it convenient and lightweight for any baseball fan. https://github.com/paaatrick/playball

Hashtags

GitHub Trends

@githubtrending · Post #15153 · 19.09.2025 г., 12:30

#javascript You can find a complete collection of recipes from the restaurant 老乡鸡 (Lao Xiang Ji) in this project, which includes detailed cooking instructions and some AI-generated images, with a web version available for easy access. This resource is not official but is based on a thorough report of their dishes, allowing you to cook like they do at home. You can also contribute your own photos to improve the collection. This helps you learn authentic recipes and cooking methods from 老乡鸡, making it easier to recreate their popular dishes yourself. The project is open for suggestions and updates, ensuring it stays useful and accurate. https://github.com/Gar-b-age/CookLikeHOC

Hashtags

GitHub Trends

@githubtrending · Post #15136 · 11.09.2025 г., 21:30

#javascript Ripple is a new TypeScript UI framework that combines the best ideas from React, Solid, and Svelte to create a fast, reactive, and easy-to-use system for building web interfaces. It uses special `$`-prefixed variables for automatic reactive updates, supports clean reusable components with JSX-like syntax, and offers strong TypeScript integration with helpful VSCode tools. Ripple also includes reactive arrays, maps, and sets, making state management intuitive. Although still in early development and not ready for production, Ripple aims to improve developer experience and performance with fine-grain rendering and scoped CSS styling, helping you build modern web apps more efficiently. https://github.com/trueadm/ripple

Hashtags

GitHub Trends

@githubtrending · Post #14924 · 07.07.2025 г., 12:00

#javascript You can learn web development easily in Hindi with a course designed for beginners and intermediate learners. It covers important skills like HTML, CSS, JavaScript, front-end and back-end development, and database integration. The course includes real projects and daily updates to help you practice and improve steadily. Learning in Hindi makes it simpler to understand coding concepts and build websites confidently, even if you are new to programming. This course is perfect if you want to start a career in web development or enhance your skills without language barriers. It offers a clear, step-by-step path to becoming a skilled web developer. https://github.com/CodeWithHarry/Sigma-Web-Dev-Course

Hashtags

GitHub Trends

@githubtrending · Post #14823 · 12.06.2025 г., 11:30

#javascript AJ-Report is an open-source business intelligence platform that helps users control business dynamics with data. It supports multiple data sources like MySQL and Elasticsearch, and users can create dashboards easily by dragging and dropping components. The platform allows users to configure data sources, write SQL for datasets, and design dashboards in just three steps. This makes it easy for anyone to create interactive and visually appealing reports without needing extensive coding skills. The benefit to users is that they can make data-driven decisions quickly and efficiently. https://github.com/anji-plus/report

Hashtags

123•••10•••20•••2425
ПретходнаСтраница 1 од 25Следна