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

Резултати

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

Пребарај: #ethics

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

@ai_and_law · Post #685 · 23.10.2025 г., 07:04

📖AI “Poverty Porn” and the Ethics of Fundraising Imagery A new Lancet Global Health article by Arsenii Alenichev and colleagues exposes how nonprofits are increasingly using AI-generated “poverty porn”: emotionally charged, stereotypical depictions of suffering, to drive donations. Researchers found over 100 such AI images circulating on LinkedIn and X, many echoing outdated fundraising aesthetics. Despite long-standing criticism of exploitative imagery, generative AI now makes it cheaper and easier to reproduce, while companies like Adobe and Freepik profit from licensing these visuals. The paper highlights that existing content policies by AI and stock image firms fail to address this form of exploitation, even as they regulate other abuses like sexualized content. Some companies, such as Freepik, say they comply with current regulations and would welcome clearer international standards. Meanwhile, researchers warn that substituting “fake” victims for real ones doesn’t eliminate ethical concerns — it risks reinforcing racial and cultural bias while eroding public trust. Alenichev and co-authors call for transparency in AI image generation, disclosure of prompts used, and greater support for local photographers creating authentic, respectful representations of global health realities. As AI reshapes storytelling and fundraising, governance frameworks must evolve to prevent digital exploitation disguised as empathy. #AI#Ethics#AIRegulation

Compliance Hub Association

@hub_compliance · Post #313 · 09.04.2024 г., 04:47

Представитель Compliance Hub Айгерим Ибраимова посетила Society of Corporate Compliance and Ethics (SCCE) 12th Annual European Compliance & Ethics Institute в Амстердаме. Данное мероприятие предоставляет возможность обменяться опытом и поделиться новыми взглядами по вопросам управления системой комплаенс, совершенствования корпоративного управления, этики, а также обсудить актуальные тенденции и вызовы в области комплаенс. #compliance#ethics

AI & Law

@ai_and_law · Post #515 · 27.02.2025 г., 08:04

🇬🇧Musicians Fight AI Copyright Changes in Silence Over 1,000 musicians, including Kate Bush and Cat Stevens, have released a silent album to oppose the UK government’s proposed copyright changes, which could allow AI companies to train on creative works without permission. The 12-track album, titled "Is This What We Want?", spells out a clear message: “The British government must not legalise music theft to benefit AI companies.” Artists argue that the proposal reverses fundamental copyright principles, effectively handing their life’s work to AI developers for free. Figures like Elton John, Paul McCartney, and Andrew Lloyd Webber have joined the opposition, warning that weakening copyright laws will undermine the UK’s creative industries. With public consultation closing, the battle over AI and intellectual property is far from over. #AI#Copyright#Ethics

AI & Law

@ai_and_law · Post #678 · 14.10.2025 г., 07:04

🇮🇹Italian DPA Bans Deep Nude App Over Human Dignity and Privacy Risks Garante per la protezione dei dati personali (Italian DPA) has officially banned the app Clothoff, which enables users to generate “deep nude” images of real people, including minors, without consent or verification. The authority highlighted that the app allows both free and paid creation of fake explicit content without any disclosure that the images are AI-generated. The DPA emphasized that the ban was necessary due to “high risks to fundamental rights and freedoms,” particularly concerning human dignity, privacy, and personal data protection. An investigation has been launched to address the broader ecosystem of nudity apps. Recent Italian news reports show how the misuse of such generative tools has already caused significant social alarm. #AIRegulation#Ethics#Deepfakes

Compliance Hub Association

@hub_compliance · Post #51 · 26.09.2023 г., 04:36

В ряде юрисдикций сегодня отмечается Compliance Officer Day. День, который призван уделить внимание важности профессии комплаенс-офицера. Compliance Hub поздравляет всех причастных! И да, не забудьте сегодня сказать "Спасибо!" вашему коллеге из подразделения комплаенс (и да, про AML офицера и других ребят тоже не забудьте). #compliance#ethics#amlcft

📢Hurmatli professor-o‘qituvchilar, tinglovchilar va mehmonlar! 🛡 Sizlarni dolzarb va zamonaviy “Cybersecurity and Ethics (Kiberxavfsizlik va etika)” mavzusidagi mahorat darsiga taklif etamiz. Mahorat darsi xalqaro darajadagi ekspert, kiberxavfsizlik sohasida 25 yildan ortiq tajribaga ega mutaxassis, University of North GeorgiaProfessoriMurthy V. Rallapalli, Ph.D, CISSP (Certified Information Systems Security Professional) tomonidan olib boriladi. ❗Mahorat darsida quyidagi masalalarga alohida e’tibor qaratiladi: ✔️ Zamonaviy kiberxavfsizlik tahdidlari va ularning oldini olish strategiyalari; ✔️ Raqamli muhitda axloqiy me’yorlar va mas’uliyat; ✔️ Sun’iy intellekt va katta ma’lumotlar bilan ishlashda etik muammolar; ✔️ Global tajriba va xalqaro standartlar asosida kiberxavfsizlikni rivojlantirish. Joylar soni cheklangan. Tadbir ingliz tilida olib boriladi 🗓Sana: 22-aprel, 2026-yil ⏱Vaqti: 15:30 📌Manzil: Biznes va tadbirkorlik oliy maktabi (5-qavat, 4-auditoriya) 📞Telefon: +998 71 239-03-03 🇷🇺RU 🇬🇧ENG #GSBE#GraduateSchool#Study#Cybersecurity#Ethics 🔝Web-site |🔝Facebook | 🔝Instagram | 🔝Youtube

Compliance Hub Association

@hub_compliance · Post #134 · 21.12.2023 г., 05:17

В декабре 2023 года состоялось закрытое мероприятие для комплаенс подразделений компаний, входящих в холдинг Freedom Holding Corp., где член и соучредитель Compliance Hub Асель Абдукасымова выступила с презентацией о деятельности Compliance Hub и рассказала о миссии, участниках, основных направлениях работы и будущих планах. Говорить о комплаенс - важно и нужно. #compliance#ethics#anticorruption

Compliance Hub Association

@hub_compliance · Post #145 · 27.12.2023 г., 02:44

В прошедшую субботу Compliance Hub в лице Тимура Мусина и Рустама Ахметова провели интересную сессию, посвященную вопросам комплаенс, для магистрантов Graduate School of Business Almau из Таджикистана. #compliance #amlcft #ethics #esg

Compliance Hub Association

@hub_compliance · Post #293 · 28.03.2024 г., 11:24

Только недавно отгремел наш Impact the Future в рамках International Women's Day, где мы поделились полезными знаниями о комплаенс с женскими ИТ, бизнес, финтех сообществами. Для Compliance Hub Community как для сообщества, продвигающего этичную, антиотмывочную, антикоррупционную культуру, это чрезвычайно важное событие и миссия. По ссылке вы также можете ознакомиться с записью данного ивента: https://www.youtube.com/live/rVD1ht8Fnro?si=zVr8e1IsjVePvYnz #compliance#amlcft#ethics#womenincompliance

AI & Law

@ai_and_law · Post #528 · 18.03.2025 г., 08:04

🇺🇸Google’s Gemini AI Caught in Copyright Controversy Google’s new Gemini 2.0 Flash model has been found capable of removing watermarks from copyrighted images, including those from Getty Images and other stock media providers. Unlike competing models like OpenAI’s GPT-4o and Anthropic’s Claude, which refuse to alter watermarked images, Gemini 2.0 Flash not only removes them but also reconstructs the missing portions—raising serious copyright concerns. While Google labels the feature as “experimental” and “not for production use,” its lack of built-in safeguards could provoke legal challenges. Under U.S. copyright law, removing a watermark without permission is generally illegal. As AI models gain more advanced image manipulation capabilities, pressure on tech companies to implement stricter guardrails will only increase. #AI#Copyright#AIGovernance#Ethics#GoogleGemini

ПретходнаСтраница 1 од 3Следна