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

Резултати

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

Пребарај: #bobkane

当前筛选 #bobkane清除筛选
📺 AnimeAction++

@animeactioz · Post #4314 · 25.06.2025 г., 18:27

Batman & Mr. Freeze: SubZero aka Batman Animated Movie II: The Iceman's Cometh 🗓Año 1998 ⏱️Duración 70min. 🎥Dirección#BoydKirkland 📄Guion Boyd Kirkland, Randy Rogel. 👤Personajes#BobKane, DC Comics 🎼Música Michael McCuistion 🎬Productora Warner Bros. Animation, Warner Bros. Género#Animación#Cienciaficción#Acción#Drama#Superhéroes#Cómic#DCComics Reparto | Trailer | Sinopsis | Premios Ver Aquí SagaDC Comics: Batman AnexoPremiadas

📺 AnimeAction++

@animeactioz · Post #4316 · 25.06.2025 г., 18:28

Batman Beyond: Return of the Joker aka Batman of the Future: Return of the Joker 🗓Año 2000 ⏱️Duración 77min. 🎥Dirección#CurtGeda 📄Guion Paul Dini, Glen Murakami, Bruce W. Timm. 👤Personajes#BobKane 🎼Música Kristopher Carter 🎬Productora Warner Bros. Animation. Productor Bruce W. Timm Género#Animación#Acción#Cienciaficción#Thriller#Superhéroes#Cómic#DCComics Reparto | Trailer | Sinopsis | Premios Ver Aquí SagaDC Comics: Batman AnexoPremiadas

📺 AnimeAction++

@animeactioz · Post #3294 · 13.07.2023 г., 19:51

DC The Batman Season 5 📅Año Septiembre 2007 - Marzo 2008 🎥Dirección Brandon Vietti, Seung Eun Kim, Anthony Chun, Sam Liu, Vinton Heuck, Chris Berkeley, Matt Youngberg, John Fang 👤Personajes#BobKane 🎼Música Thomas Chase 🎬Productora Warner Bros. Animation, DC Comics, Warner Bros. Productor#MichaelGoguen (Creador), #DuaneCapizzi (Creador) Género#SeriedeTV#Animación#Fantástico#Acción#Superhéroes#Cómic#DCComics Resumen Batman, Batgirl y Robin hacen equipo con la Liga de la Justicia, y también con aquellos que no forman parte de la Liga como Superman, que por cierto usaron a Brandon Routh como base para este Superman y curiosamente el propio Routh hace la voz del villano Vértigo. Este sería el fin de la serie a pesar de dejar un final abierto. ⏱Duración 22min. 🖥Resolución 720x400 🗣Idioma Latino Season 5 Episodio 01 - 02 - 03 - 04 - 05 - 06 - 07 - 08 - 09 -10 - 11 - 12 - 13 Season1 - 2 - 3 - 4 Suscripción a esta Serie 👉🏻Aquí Índice de Animaciones 👉🏻Aquí

📺 AnimeAction++

@animeactioz · Post #3293 · 13.07.2023 г., 19:32

DC The Batman Season 4 📅Año Septiembre 2006 - Mayo 2007 🎥Dirección Brandon Vietti, Seung Eun Kim, Anthony Chun, Sam Liu, Vinton Heuck, Chris Berkeley, Matt Youngberg, John Fang 👤Personajes#BobKane 🎼Música Thomas Chase 🎬Productora Warner Bros. Animation, DC Comics, Warner Bros. Productor#MichaelGoguen (Creador), #DuaneCapizzi (Creador) Género#SeriedeTV#Animación#Fantástico#Acción#Superhéroes#Cómic#DCComics ⏱Duración 22min. 🖥Resolución 720x400 🗣Idioma Latino Resumen Dick Grayson era un joven artista de circo, cuyos padres mueren en un accidente mientras realizaban una actuación en él. Tras ello, Bruce lo adopta. Robin comienza su vida de héroe. Batman, Robin y Batgirl unen fuerzas con el Detective Marciano para detener la invasión de la fuerza extraterrestre, conocida como "The Joining". Season 4 Episodio01 - 02 - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 - 11 - 12 - 13 Season1 - 2 - 3 - 5 Suscripción a esta Serie 👉🏻Aquí Índice de Animaciones 👉🏻Aquí

📺 AnimeAction++

@animeactioz · Post #3292 · 13.07.2023 г., 14:57

DC The BatmanSeason 3 📅Año Septiembre 2005 - Mayo 2006 🎥Dirección Brandon Vietti, Seung Eun Kim, Anthony Chun, Sam Liu, Vinton Heuck, Chris Berkeley, Matt Youngberg, John Fang 👤Personajes#BobKane 🎼Música Thomas Chase 🎬Productora Warner Bros. Animation, DC Comics, Warner Bros. Productor#MichaelGoguen (Creador), #DuaneCapizzi (Creador) Género#SeriedeTV#Animación#Fantástico#Acción#Superhéroes#Cómic#DCComics Resumen Barbara Gordon, la hija del comisionado, asume el rol de Batgirl, aunque Batman no tiene ningún interés en que lo ayude en la lucha contra el crimen y trata de hacerla abandonar esa identidad. Esto acaba con el episodio Truenp, en el que Bruce, iluminado por su leal mayordomo y amigo, Alfred le toma a Batgirl como su ayudante. ⏱Duración 22min. 🖥Resolución 720x400 🗣Idioma Latino Season 3 Episodio 01 - 02 - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 - 11 - 12 - 13 Season1 - 2 - 4 - 5 Suscripción a esta Serie 👉🏻Aquí Índice de Animaciones 👉🏻Aquí

📺 AnimeAction++

@animeactioz · Post #4334 · 25.06.2025 г., 18:34

Batman: Arkham Asylum 🗓Año 2009 ⏱️Duración 128min. País🇬🇧Reino Unido 🎥Dirección#SeftonHill 📄Guion Paul Dini, Paul Crocker. 👤Personajes#BobKane 🎼Música Nick Arundel, Ron Fish 🎬Productora DC Comics, Rocksteady Studios, Warner Bros. Interactive Entertainment (WBIE). 🚚Distribuidora Eidos Interactive, Warner Bros. Interactive Entertainment (WBIE) Género#Animación#Acción#Thriller#Superhéroes#Cómic#DCComics#Videojuegonarrativo Reparto | Trailer | Sinopsis Ver Aquí SagaDC Comics: Batman

📺 AnimeAction++

@animeactioz · Post #4320 · 25.06.2025 г., 18:31

The Batman vs Dracula: The Animated Movie 🗓Año 2005 ⏱️Duración 80min. 🎥Dirección#MichaelGoguen 📄Guion Duane Capizzi. 📖Historia Michael Jelenic 👤Personajes#BobKane, #BramStoker 🎼Música Doug Andorka 🎬Productora Warner Bros. Animation Género#Animación#Fantástico#Acción#Vampiros#Superhéroes#Cómic#DCComics Reparto | Trailer | Sinopsis | Premios Ver Aquí SagaDC Comics: Batman AnexoPremiadas

📺 AnimeAction++

@animeactioz · Post #4319 · 25.06.2025 г., 18:29

Batman: Mystery of the Batwoman 🗓Año 2003 ⏱️Duración 74min. 🎥Dirección#CurtGeda, #TimMaltby 📄Guion Michael Reaves, Alan Burnett. 👤Personajes#BobKane 🎼Música Lolita Ritmanis 🎬Productora Warner Bros. Género#Animación#Acción#Aventuras#Intriga#Superhéroes#Cómic#DCComics Reparto | Trailer | Sinopsis Ver Aquí SagaDC Comics: Batman

📺 AnimeAction++

@animeactioz · Post #4307 · 25.06.2025 г., 18:24

Batman: Mask of the Phantasm 🗓Año 1993 ⏱️Duración 76min. 🎥Dirección#EricRadomski, #BruceWTimm 📄Guion Paul Dini, Alan Burnett, Martin Pasko, Michael Reaves. 👤Personajes#BobKane 🎼Música Shirley Walker 🎬Productora Warner Bros. Animation, Dong Yang Animation, Spectrum Animation Studio. Productor Bruce W. Timm Género#Animación#Fantástico#Acción#Misterio#Superhéroes#Cómic#DCComics Reparto | Trailer | Sinopsis | Premios Ver Aquí SagaDC Comics: Batman AnexoMisterio | Premiadas

📺 AnimeAction++

@animeactioz · Post #3291 · 13.07.2023 г., 13:36

The Batman Season 2 📅Año Mayo 2005 - Septiembre 2005 🎥Dirección Brandon Vietti, Seung Eun Kim, Anthony Chun, Sam Liu, Vinton Heuck, Chris Berkeley, Matt Youngberg, John Fang 👤Personajes#BobKane 🎼Música Thomas Chase 🎤Opening#TheEdge del grupo #U2 🎬Productora Warner Bros. Animation, DC Comics, Warner Bros. Productor#MichaelGoguen (Creador), #DuaneCapizzi (Creador) Género#SeriedeTV#Animación#Fantástico#Acción#Superhéroes#Cómic#DCComics ⏱Duración 22min. 🖥Resolución 608x448 🗣Idioma Latino Season 2 Episodio01 - 02 - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 - 11 - 12 - 13 Season1 - 3 - 4 - 5 Suscripción a esta Serie 👉🏻Aquí Índice de Animaciones 👉🏻Aquí

📺 AnimeAction++

@animeactioz · Post #3290 · 13.07.2023 г., 13:34

The BatmanSeason 1 📅Año 2004 🎥Dirección Brandon Vietti, Seung Eun Kim, Anthony Chun, Sam Liu, Vinton Heuck, Chris Berkeley, Matt Youngberg, John Fang 📄Guion Steven Melching, Alexx Van Dyne, Joseph Kuhr, Greg Weisman, Stan Berkowitz, Michael Jelenic, Bob Goodman, Jane Espenson, Douglas Petrie. 👤Personajes#BobKane 📝Diseño de Personajes#JeffMatsuda 🎼Música Thomas Chase 🎤Opening#TheEdge del grupo #U2 🎬Productora Warner Bros. Animation, DC Comics, Warner Bros. Productor#MichaelGoguen (Creador), #DuaneCapizzi (Creador) 🚚Distribuidora The WB, The CW, HBO Género#SeriedeTV#Animación#Fantástico#Acción#Superhéroes#Cómic#DCComics Reparto | Intro | Sinopsis | Premios ⏱Duración 22min. 🖥Resolución 720x400 🗣Idioma Latino Season 1 Episodio01 - 02 - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 - 11 - 12 - 13 Season2 - 3 - 4 - 5 Suscripción a esta Serie 👉🏻Aquí Índice de Animaciones 👉🏻Aquí

📺 AnimeAction++

@animeactioz · Post #3627 · 08.12.2023 г., 06:56

Justice LeagueSeason 2 📅Año Julio 2003 - Mayo 2004 🎥Dirección#DanRiba, #ButchLukic 📄Guion Stan Berkowitz, Rich Fogel, Dwayne McDuffie, Keith Damron, Joseph Kuhr, Paul Dini, Bruce Timm 👤Personajes#DCComics, Batman (#BobKane), Superman (#JerrySiegel, #JoeShuster), Wonder WWoman (#WilliamMoultonMarston), Brainiac (#OttoBinder), Etrigan (#JackKirby) 🎼Música Lolita Ritmanis, Kristopher Carter, Michael McCuistion 🎬Productora Warner Bros. Animation, DC Comics, Warner Bros.. Productor Bruce W. Timm. 🕰Emitida por Cartoon Network Género#SeriedeTV#Animación#Acción#Aventuras#Fantástico#Cienciaficción#Thriller#Superhéroes#Cómic#DCComics Premios ⏱Duración 22min. 🖥Resolución 720x400 🗣Idioma Latino Season 2 Episodio01 - 02 - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 - 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 20 - 21 - 22 - 23 - 24 - 25 - 26 Season1 - Justice League Unlimited Season 1 - 2 - 3 Suscripción a esta Serie 👉🏻Aquí Índice de Animaciones 👉🏻Aquí

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