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

Пребарај: #edps

当前筛选 #edps清除筛选
AI & Law

@ai_and_law · Post #670 · 02.10.2025 г., 07:04

🇪🇺Human Oversight in Automated Decision-Making: EDPS Weighs In The European Data Protection Supervisor (EDPS) has released a new TechDispatch examining the role and limits of human oversight in automated decision-making technologies (ADMT). The report highlights both the necessity of human involvement and the risks of overestimating its effectiveness. While oversight is often seen as a safeguard against bias, misclassification, and opacity in ADM systems, the EDPS warns that inserting humans into the process does not automatically guarantee fairer or safer outcomes. The paper underscores that flawed assumptions about human involvement can lead to weak or symbolic oversight, risking harm to individuals and undermining fundamental rights such as privacy, non-discrimination, and due process. For oversight to be meaningful, it must be carefully designed, accounting for the complexities of human-machine interaction and ensuring accountability remains with system providers and deployers. The EDPS calls for structured approaches that align oversight practices with ethical standards, societal values, and democratic principles. #AIRegulation#FundamentalRights#EDPS

AI & Law

@ai_and_law · Post #704 · 18.11.2025 г., 08:04

🇪🇺EDPS Releases New Guidance on AI Risk Management for EU Institutions The European Data Protection Supervisor has issued guidance designed to help data controllers assess risks when developing, procuring, or deploying AI systems. Although targeted at EU institutions, offices, and agencies, the document also serves as a practical reference for private organizations aiming to align AI practices with existing data protection obligations. The guidance outlines a structured approach to risk management methodology, emphasizes AI life cycle oversight, and integrates interoperability considerations. It also examines specific categories of risk and pairs them with corresponding technical mitigation measures — offering a clearer operational pathway for organizations working to embed data protection into AI governance. #AI#Law#AIGovernance#EDPS#DataProtection

AI & Law

@ai_and_law · Post #326 · 10.06.2024 г., 07:04

EDPS Issues Guidance on Data Protection for Generative AI Systems The European Data Protection Supervisor (EDPS) has released new guidance on ensuring data protection compliance when using generative AI systems. This guidance is pivotal, given the EDPS's crucial role in the AI Act. According to the AI Act, the EDPS will: ✅ Establish AI regulatory sandboxes for EUIs ✅ Participate as an observer in the European AI Board ✅ Supervise EUIs under the AIA ✅ Act as a market surveillance authority for EUIs ✅ Impose administrative fines on EUIs. These roles mean that the EDPS's interpretations and guidance on AI development and use will significantly impact other AI operators. Despite lack of specificity in some areas, the guidance provides a good initial overview of key challenges in generative AI. #AI#DataProtection#EDPS#AIAct#GenerativeAI

AI & Law

@ai_and_law · Post #792 · 25.03.2026 г., 08:04

🇪🇺EDPS Defines Role Under the EU AI Act The European Data Protection Supervisor (EDPS) published a report outlining its responsibilities as the AI Act market authority for AI systems used by EU institutions. The document sets out priority areas for the next two years as the EDPS assumes its new supervisory role. The report details the EDPS’s tasks under the AI Act mandate, the operational context for exercising its authority, and four strategic pillars that will guide its work as a market authority. #AIRegulation#EUAIAct#DataProtection#AIgovernance#EDPS

AI & Law

@ai_and_law · Post #745 · 19.01.2026 г., 08:04

🇪🇺EDPS Launches Podcast Series on Emerging AI Trends The European Data Protection Supervisor has launched a new podcast series examining key AI trends identified in its TechSonar 2025–26 report. The six-part series focuses on how emerging AI technologies intersect with data protection, security, and fundamental rights. The first episode discusses agentic AI, with EDPS officials addressing risks for personal data protection and potential impacts on individuals’ decision-making autonomy. Upcoming episodes will cover AI companions, automated proctoring, AI-driven personalized learning, coding assistants, and confidential computing. #AIRegulation#DataProtection#EDPS#AITrends#ResponsibleAI

AI & Law

@ai_and_law · Post #142 · 19.10.2023 г., 07:04

European Data Protection Supervisor Weighs In on AI Liability Rules Hello, everyone! The European Data Protection Supervisor (EDPS) provided valuable insights into the European Commission's two proposals, addressing liability rules for artificial intelligence products. These proposals focus on establishing liability for AI developers producing "defective products" and defining civil liability regulations for individuals negatively affected by AI systems. The EDPS presented several key recommendations. Notably, they emphasized the need for uniform protection levels, ensuring that individuals harmed by defective AI systems employed by EU institutions receive the same protection as those impacted by a private entity's use of such systems. These recommendations highlight the ongoing efforts to shape comprehensive AI liability frameworks in the European Union, aiming to balance innovation and safeguard individual rights. #AIandLaw#EDPS#AILiability#EURegulations