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

Пребарај: #antitrust

当前筛选 #antitrust清除筛选
🦅 [ perspective ix ]

@perspectiveix · Post #1761 · 21.03.2019 г., 13:30

​​💰Google Hit With Another Antitrust Fine in Europe The European Commission announced yet another #antitrust fine against #Google today, imposing a €1.49 billion ($1.69b) penalty for unfairly shielding its AdSense advertising platform from competition. "Today the Commission has fined Google €1.49 billion for illegal misuse of its dominant position in the market for the brokering of online search adverts. Google has cemented its dominance in online search adverts and shielded itself from competitive pressure by imposing anti-competitive contractual restrictions on third-party websites", commissioner Margrethe Vestager said in an official statement. The European Commission’s latest ruling against Google is by no means the first time that the EU’s watchdog has taken action against an American tech company. In fact, Google itself got a taste of EU antitrust regulation as recently as last year. In July 2018, the European Commission hit Google with a record-breaking €4.3 billion fine for allegations related to #Android after having fined the company €2.4 billion ($2.7b) for anticompetitive behavior related to Google Shopping in July 2017. As the following chart illustrates, other tech giants have felt the wrath of the European Commission as well. #Microsoft alone has been fined four times over the past two decades including three times for allegedly ignoring previous antitrust sanctions and for breaking promises made in an earlier antitrust settlement. The EU’s competition commissioner, Margrethe Vestager, has made U.S. tech companies a central focus, cracking down on anticompetitive behavior, tax avoidance and mishandling of user privacy. 🚀@PerspectiveIX via Statista.

AI & Law

@ai_and_law · Post #516 · 28.02.2025 г., 08:04

🇺🇸Chegg Takes Google to Court Over AI Overviews Chegg has filed an antitrust lawsuit against Google, claiming that AI-generated search summaries are siphoning traffic and revenue from its platform. The lawsuit, filed on February 24, marks the first known legal challenge by a single company against Google's AI Overviews. Chegg alleges that Google is leveraging its market dominance to pressure companies into having their content used for AI-generated results—without compensation. CEO Nathan Schultz argues that Google is “reaping the financial benefits of Chegg’s content without having to spend a dime.” Facing declining revenues, Chegg is now considering going private or seeking acquisition. This case could set a precedent for how AI-generated content interacts with copyright and competition law. #AI#Antitrust#Copyright#AIRegulation#Google

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 #240 · 14.02.2024 г., 08:04

US FTC Hosts Inaugural AI Policy Summit Greetings everyone! The US Federal Trade Commission (FTC) held its first public summit on AI policy on January 25, 2024, focusing on antitrust and consumer protection challenges posed by AI technology's rapid evolution. The event convened experts from academia, industry, and government to discuss competition and consumer protection considerations in AI. FTC leaders expressed concerns about anticompetitive practices and consumer protection risks stemming from the adoption of large language models and generative AI. The agency is exploring enhanced enforcement in the AI sector while developing its liability regime. FTC Chair Lina Khan highlighted worries about incumbent tech companies consolidating control of the AI sector through vertical integration, leveraging their influence over training data and infrastructure. The FTC also signaled intentions to address consumer protection issues related to harmful AI applications and privacy violations in training data collection. The FTC announced a Section 6(b) inquiry into recent AI investments and partnerships between developers and cloud service providers to study their competitive impact. The summit reflects the FTC's commitment to understanding and regulating AI's impact on competition and consumer welfare. #FTC#AIPolicySummit#Antitrust#ConsumerProtection

Crypto M - Crypto News

@CryptoM · Post #64920 · 10.04.2026 г., 09:33

🚀 Meta's Legal Challenges May Impact Long-Term Share Recovery Meta Platforms Inc. is facing legal challenges that could affect its long-term stock recovery. Wall Street Journal (Markets) posted on X that the company, known for its social media platforms like Facebook and Instagram, is dealing with various lawsuits that may influence investor sentiment and stock performance. These legal issues include antitrust cases and privacy concerns, which have been ongoing for some time. The company's shares have experienced fluctuations due to these legal battles, and analysts suggest that the outcomes could have significant implications for Meta's market position. While the company continues to innovate and expand its services, the legal environment remains a critical factor for investors to consider. Meta's leadership is focused on addressing these challenges while maintaining its growth trajectory. However, the uncertainty surrounding the legal proceedings could lead to volatility in the stock market. Investors are advised to keep a close watch on developments in these cases as they unfold. #Meta#LegalChallenges#StockRecovery#Antitrust#PrivacyConcerns#InvestorSentiment#MarketVolatility#WallStreetJournal#Facebook#Instagram#StockPerformance#InvestorWatch