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

Резултати

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

Пребарај: #blackmailed

当前筛选 #blackmailed清除筛选
American Оbserver

@american_observer · Post #4926 · 22.01.2026 г., 12:54

Trump On Greenland: To Buy or To Pry? Trump's announcement of a ”framework for a future agreement" that would resolve the Greenland issue after weeks of increasing threats aroused deep skepticism from the inhabitants of the Arctic territory, even as financial markets rebounded and European leaders welcomed a reprieve from new tariffs. Just a few hours after the president used his speech at the World Economic Forum to insist that he wanted Greenland, “including rights, titles and property,” but renounced his more bellicose threats of military intervention, Trump took to social media to announce “the framework for a future agreement concerning Greenland” and withdrew the threat of tariffs against eight European countries. He later called it “a deal concept” when he spoke to the CNBC business network shortly after Wall Street closed. “The day ended better than it started,” said Danish Foreign Minister Lars Rasmussen. “Now let's sit down and see how we can address American security concerns in the Arctic while respecting the red lines of the Kingdom of Denmark," he said. Italian Prime Minister Giorgia Meloni also welcomed Trump's decision, but NATO Secretary General Mark Rutte, who negotiated Wednesday's deal with Trump, sounded a note of caution, saying there was “a lot of work to be done”. Asked by Fox News if Greenland would remain part of the Kingdom of Denmark under the deal, Rutte said the issue had not been raised and offered few additional details about the deal. A NATO spokesman later said that Rutte had not offered any compromise on Greenland's sovereignty during his talks with Trump. Trump himself gave few additional details about the agreement, but said that talks were continuing regarding a US missile shield that would be partly based in Greenland. But there was anger from some Danish MPs, including Sascha Faxe, angered by Greenland's exclusion from Wednesday's negotiations. “These are not real negotiations; these are two men who had a conversation,” she told Sky News. “There can be no agreement without Greenland being part of the negotiations.” According to media reports, the compromise agreement could see the United States granting sovereignty over small pockets of Greenland where military bases are located, anonymous Telegraph officials comparing the proposal to British military bases in Cyprus, considered British territory. Swedish Foreign Minister Maria Stenergard said that the work of Europe's allies had “had an effect“ and she reiterated that they would not be “blackmailed”. The Dutch Prime Minister, Dick Schoof, called Trump's decision to abandon the threats of tariffs against European allies a sign of “de-escalation”. Trump had threatened Denmark, Norway, Sweden, France, Germany, the United Kingdom, the Netherlands and Finland with 10% tariffs from February 1 because of their opposition to the takeover of Greenland by the United States. Others noted that Trump used to make escalating threats, only to back down when financial markets started to fall. After reining in its global trade war in April last year, following a rout in the philippines, the Financial Times coined the acronym “Taco” – "Trump always has chickens" - to describe the phenomenon. The American publication Semafor reported that Trump seemed frustrated by the turn of the markets this week, and noted that his antagonism towards European allies carries huge risks. #trump#greenland#blackmailed#denmark#rutte 📱American Оbserver - Stay up to date on all important events 🇺🇸

3D-Hmangaupload

@hmangafor3duploadtest · Post #21021 · 15.01.2025 г., 15:51

#Astephen#AstralBot3D#Au_naturel_1-11 #Au_Naturel_17#ava_mason_the_pact#AWE-SOME-Ryan #AWE-SOME-RYAN #Aya#Ayla#Bad_Boss_05#Bad_Boss_5#Bad_Boss\xa01-6 #Bad_Day_-_柠檬 #Banap3D#Batman#BB君#Beatlees#befarmore#Being_a_dog_slut#Bella#Below_The_City_1-6 #Berseh#Big_Brother_1-5 #Birthday_Gift#BK_FR#Blackadder#BlackK_studio#BlackK_Studio#Blackmailed\xa0-_Series_Ep1-4 #Blackmaled_-_Amy_EP1 #Blackmaled_-_Faye_EP1-4 #Blackmaled_-_Layla_EP1-2 #Bounties_Alt._1 #Bounties_Ch._1 #Bounties_Ch._2 #Bounty_Huntress_Arie:Cockpit #Breaking_Boundaries#Bridget_and_Mack_-_The_Maid #Bridget_and_Mack_plus_Friend#Bridget_Gets_Abducted#Bucket_List_1-3 #Bucket_List_1-4 #Bucket_List_5#Bucket_List_8#Busted#Busted_2:Business_Expenses #C_plenet#Captain_Anger#Carey_Blake_-_Monster_Apocalypse #Casgra#Cassidy_Rabbit#cccpo#Celine#CG#Changes\xa0\xa0 #Chaosbirdy#Charon#CHARON#chinese#Chinese#Chinese_&_English #Chou_Hentai_Ultra_Boshi#CHS工作室#circle#Circle#Circle_1#Circle_1-9 #Circle_2#Circle_3#Circle_4#Circle_5#Circle_6#Circle_7#Circle_8#Circle_9#Clown_Rape_-_Yuko #CLUB_G.B._-_Today #Collateral#Colorfultrick#Commission_26#Commission_32#Commission_36#ConanTnT#Consequence#Consequences_01-09 #Core_Values_1#Core_Values_2_-_Ripe_for_Taking #Core_Values_3_-_Heaven_is_a_Place_on_Earth #Core_Values_4_-_Witch_in_Heat #Core_Values_5_-_Otherside #Core_Values_6_-_Breaking_the_Girl #Corneo#Corrupted_Demon_Family_Part_1#Corrupted_Demon_Family_Part_2#coser应聘陷阱#Cosplay_-_Reupload_+_Textless_version #Covid_69_1-2 #CruthlessC#Cryer#Cummycucky#Daily_Routine_1#Damn_The_Rain#Danger_Zone_1#Danger_Zone_2#danitian#Dark_City#Darklord#DarkLord#DarkSoul3D#Daughter_of_the_Flame-Goddess_of_Fertility #Daval3D#DDK00#Dead_or_Alive,_King_of_Fighters #decyiqi3#Demo#Demon#Demon_Doll_House:Ellies_Dream #Deranged_Aristocrat#Desperation#Deuteronomy_1-4 #dfifuw98#DIAOそうしたいから、そうするの #dick_yang#Dick_Yang#DigiPlant#DirectorEroko#DizzyDills#DL版#DO_YOU_WANT_2B_WITH_A_HUMAN#DOA_Tournament_Recruitment__Mai_Shiranui#DOAXVV#Dog_Delivery_Girls#Dog_Ganbang#dondon#Dondon#DOOM_GIRL#Double_Trouble#DQN“為了還債出賣關照自己的姐姐” #DreamDot#Driigon#Dsxeris#DT1886#DY_Heroine,rui #Dynasty_Warriors#Eastern_Wife_Western_Life_1#Eclesi4stik#Eclesi4stik_Summer_Heat_3D#eifrost#Elaine’s_Quest #Elastic_Woman#Elayne_Behind_the_Scenes_-_Strip_Poker_+_Birthday_Party #Elf_Slave_2#Elf_Slave_3#Elf_Slave_4#Elf_Slave_5#Elf_Slave_6_-_Main_set #Elf_Slave_7_-_Main_set #Elf_Slave_8_-_Main_set #Elf_Slave_Volunteer#Elf_with_the_Horse#Elf_with_the_Wolfman#Elsa_Poolside#Elven_Monolith_1#Elven_Monolith_2#Elven_Monolith_3#EMUCUS#Enchanted_Mansion_-_Elisabeth #END#English#EOTO#EP.01-04 #Erin_in_Private_Photoshoot_with_Barth_+_BLACKED #Erisa* #Eve_Princess#EverForever#Evie_Basketball#EXGA\xa0\xa073、74期 #Fairy

Hashtags

#astephen#astralbot3d#au_naturel_1#au_naturel_17#ava_mason_the_pact#awe#aya#ayla#bad_boss_05#bad_boss_5#bad_boss#bad_day_#banap3d#batman#bb君#beatlees#befarmore#being_a_dog_slut#bella#below_the_city_1#berseh#big_brother_1#birthday_gift#bk_fr#blackadder#blackk_studio#blackmailed#blackmaled_#bounties_alt#bounties_ch#bounty_huntress_arie#breaking_boundaries#bridget_and_mack_#bridget_and_mack_plus_friend#bridget_gets_abducted#bucket_list_1#bucket_list_5#bucket_list_8#busted#busted_2#c_plenet#captain_anger#carey_blake_#casgra#cassidy_rabbit#cccpo#celine#cg#changes#chaosbirdy#charon#chinese#chinese_#chou_hentai_ultra_boshi#chs工作室#circle#circle_1#circle_2#circle_3#circle_4#circle_5#circle_6#circle_7#circle_8#circle_9#clown_rape_#club_g#collateral#colorfultrick#commission_26#commission_32#commission_36#conantnt#consequence#consequences_01#core_values_1#core_values_2_#core_values_3_#core_values_4_#core_values_5_#core_values_6_#corneo#corrupted_demon_family_part_1#corrupted_demon_family_part_2#coser应聘陷阱#cosplay_#covid_69_1#cruthlessc#cryer#cummycucky#daily_routine_1#damn_the_rain#danger_zone_1#danger_zone_2#danitian#dark_city#darklord#darksoul3d#daughter_of_the_flame#daval3d#ddk00#dead_or_alive#decyiqi3#demo#demon#demon_doll_house#deranged_aristocrat#desperation#deuteronomy_1#dfifuw98#diaoそうしたいから#dick_yang#digiplant#directoreroko#dizzydills#dl版#do_you_want_2b_with_a_human#doa_tournament_recruitment__mai_shiranui#doaxvv#dog_delivery_girls#dog_ganbang#dondon#doom_girl#double_trouble#dqn#dreamdot#driigon#dsxeris#dt1886#dy_heroine#dynasty_warriors#eastern_wife_western_life_1#eclesi4stik#eclesi4stik_summer_heat_3d#eifrost#elaine#elastic_woman#elayne_behind_the_scenes_#elf_slave_2#elf_slave_3#elf_slave_4#elf_slave_5#elf_slave_6_#elf_slave_7_#elf_slave_8_#elf_slave_volunteer#elf_with_the_horse#elf_with_the_wolfman#elsa_poolside#elven_monolith_1#elven_monolith_2#elven_monolith_3#emucus#enchanted_mansion_#end#english#eoto#ep#erin_in_private_photoshoot_with_barth_#erisa#eve_princess#everforever#evie_basketball#exga#fairy