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

Резултати

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

Пребарај: #datagovernance

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

@ai_and_law · Post #727 · 19.12.2025 г., 08:04

🇺🇸⚖️When Chat Logs Become Evidence After Death A new U.S. lawsuit alleges that OpenAI selectively withholds ChatGPT logs after a user’s death. The case concerns a murder–suicide involving Stein-Erik Soelberg, whose family claims ChatGPT reinforced paranoid delusions about his mother shortly before he killed her and himself. The estate argues that OpenAI refuses to disclose complete chat histories from the critical final days, despite relying on “full context” arguments in other suicide-related litigation. According to the complaint, fragments of chats recovered from social media show ChatGPT validating conspiracy beliefs, spiritual grandiosity, and hostility toward an identified individual. The family alleges a “pattern of concealment,” noting that OpenAI has no formal policy governing user data after death and retains chats indefinitely unless manually deleted. OpenAI has declined to explain why it will not produce the remaining logs, while stating publicly that it is improving safeguards and working with mental health clinicians. The lawsuit seeks punitive damages and an injunction requiring safeguards against validating paranoid delusions, as well as clearer public warnings about known risks. Beyond liability, the case raises unresolved questions about post-mortem data governance, evidentiary transparency, and the balance between user privacy and accountability when AI systems are implicated in real-world harm. #AIandLaw#AIEthics#DataGovernance

AI & Law

@ai_and_law · Post #675 · 09.10.2025 г., 07:04

📖Generative AI Use Creates Massive Corporate Data Blind Spot A new Enterprise AI and SaaS Data Security Report 2025 by LayerX reveals that employees are regularly pasting sensitive information, including PII and PCI data, into generative AI tools like ChatGPT — often without company authorization. With 45% of enterprise employees using generative AI, 77% of them have copied and pasted data into chatbot queries, and 22% of those pastes involve sensitive personal or payment details. The security risk is compounded by the fact that 82% of these pastes come from unmanaged personal accounts, leaving companies with little to no visibility into what information is being shared. Similarly, 40% of file uploads to AI sites contain PII/PCI data, with nearly 39% originating from non-corporate accounts. This uncontrolled data flow creates a significant blind spot for enterprises, raising serious concerns about compliance, data governance, and legal accountability in AI usage. #AI#DataGovernance#Cybersecurity

AI & Law

@ai_and_law · Post #252 · 01.03.2024 г., 08:04

OECD Establishes Expert Group for AI, Data, and Privacy Policy Synergies Hello everybody! The Organisation for Economic Co-operation and Development (OECD) has launched a new expert group aimed at fostering collaboration and coherence in artificial intelligence, data, and privacy policies. With a focus on finding common ground, the group seeks to bridge the gap between data governance and AI communities. By providing a platform for stakeholders to exchange insights and best practices, the OECD aims to address the complex intersection of AI, data, and privacy regulations. Through collective efforts, the group endeavors to develop guidelines and frameworks that promote responsible AI deployment while safeguarding individual privacy rights. #OECD#AI#DataGovernance#PrivacyPolicies

AI & Law

@ai_and_law · Post #722 · 12.12.2025 г., 08:04

🇪🇺EU Opens Antitrust Probe into Google’s AI Training Practices The European Commission has launched an antitrust investigation into whether Google is using web content and YouTube uploads to train its AI systems without appropriate compensation, opt-out mechanisms, or equal access for competitors. Regulators are examining Google’s AI Overviews, AI Mode, and the use of YouTube content, noting that creators are required to grant Google permission for AI training without remuneration, while AI rivals are simultaneously blocked from using YouTube data for their own models. According to the Commission, the probe will assess whether Google imposes unfair terms on publishers and creators or grants itself privileged access to content in a way that may constitute abuse of dominance under EU competition rules. Google rejects the allegations, arguing that the inquiry risks slowing innovation and stating that tools like Google-Extended and robots.txt give publishers control, though the Commission noted concerns about the practical effects of blocking Google crawlers. T #AI#Antitrust#CompetitionLaw#DataGovernance#AIRegulation

AI & Law

@ai_and_law · Post #341 · 28.06.2024 г., 07:04

Implementing Transparency in AI: A Step Forward Zuzanna Warso and Paul Keller from Open Future, alongside Maximilian Gahntz from Mozilla, have published a proposal to implement the EU AI Act’s training data transparency requirement for general-purpose AI (GPAI). Article 53 1(d) of the Act mandates GPAI model providers to publish detailed summaries of their training content, covering data sources and sets with narrative explanations. The proposed template emphasizes a comprehensive scope and sufficient technical detail to benefit both experts and laypeople. These summaries should list primary data collections, provide narrative explanations of other data sources, and clearly distinguish between 'data sources' (origins) and 'datasets' (processed data points). This transparency requirement aims to enhance accountability, enable research and scrutiny, and strengthen individuals' and organizations' ability to exercise their rights in the AI development process. #AI#Transparency#AIAct#DataGovernance#OpenFuture#Mozilla