@Hezu2 · Post #68313 · 14.04.2026 г., 11:56
#Midjourney🌐国际版,Midjourney30刀,月付41,5人车补4人,只招长期车友,短期勿扰,跳车不退,翻车按比例退尾款。UID:7182366799 该拼车信息审核有效期已过,请勿上车。
Hashtags
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
Пребарај: #midjourney
@Hezu2 · Post #68313 · 14.04.2026 г., 11:56
#Midjourney🌐国际版,Midjourney30刀,月付41,5人车补4人,只招长期车友,短期勿扰,跳车不退,翻车按比例退尾款。UID:7182366799 该拼车信息审核有效期已过,请勿上车。
Hashtags
@AIArtsGallery · Post #8668 · 16.04.2026 г., 06:17
A beautiful blonde woman wearing red and white sneakers a beautiful blonde woman wearing red and white sneakers, floral shorts, and a transparent jacket with a rose pattern, crouching on the ground in front of tall buildings. sunlight shines through the skyscrapers in the background, creating a high-definition, full-body, front-view photograph with a fashion magazine-style, low-angle perspective, sharp focus, and natural lighting. the city background and fashionable atmosphere contribute to the overall aesthetic.highly detailed skin texture. #Midjourney
Hashtags
@AIArtsGallery · Post #8664 · 15.04.2026 г., 06:16
A woman lounging by a window inside a paris apartment effortlessly chic french lazy atmosphere, a woman lounging by a window inside a paris apartment, slightly messy hair, relaxed posture, wearing a loose white shirt slipping off one shoulder, barefoot, sitting casually on a wooden chair, soft natural late afternoon light, sheer curtains gently flowing in the breeze, warm tones, a cup of coffee on the table, subtle city view outside the window, quiet intimate mood, absent-minded gaze looking outside, minimal movement, slow breathing, cinematic slow push-in, slight handheld camera movement, soft motion blur, film grain, faded colors, low contrast, soft haze, analog 35mm film look, imperfect composition, quiet sensuality, realistic texture #Midjourney
Hashtags
@AIArtsGallery · Post #8660 · 14.04.2026 г., 06:15
A front view of a detailed futruristic black and yellow worn and scraped spacecraft fighter jet front view of a detailed futruristic black and yellow worn and scraped spacecraft fighter jet with glass cockpit and exhaust trail and pilot visible flying at high speed over an arctic ice sheet, in the background is an angry huge massive grotesque detailed horrific unnatural alien creature with tentacle that is bursting out of the ice sheet and chunks of ice are scattered and about to bite the spaceship, blue sky, windy, cold, extreme attention to detail, cinematic scene, award winning photography #Midjourney
Hashtags
@AIArtsGallery · Post #8656 · 13.04.2026 г., 06:14
A realistic photo of cat sitting on a branch of a cherry blossom tree A realistic photo of cat sitting on a branch of a cherry blossom tree in full bloom. Surrounding branches covered with soft pink and white sakura flowers. Warm spring atmosphere with gentle natural light, pastel colors, and a softly blurred background, artistic photo, made with canon 35mm 1.2 #Midjourney
Hashtags
@AIArtsGallery · Post #8652 · 12.04.2026 г., 06:12
A tall thin girl art illustration, tall thin girl, pale skin, medium short pink hair with short bangs, blue eyes, soft glow, gentle diffused lighting, melancholic atmosphere, cinematic #Midjourney
Hashtags
@AIArtsGallery · Post #8648 · 11.04.2026 г., 06:11
A steam train crossing a steel bridge over a canyon steam train crossing a steel bridge over a canyon, camera positioned very low slightly to the side, looking up at the bridge, underside of the train visible through gaps in the track and bridge structure, partial view through sleepers, angled perspective, sky background, cinematic, photoreal #Midjourney
Hashtags
@AIArtsGallery · Post #8644 · 10.04.2026 г., 06:33
A beautiful redhead woman looking at the camera A beautiful redhead woman looking at the camera in a field of poppies, a romantic atmosphere, the woman has picked poppies, in an airy dress, the sky is bright, in the background a tripod with a painting, shot with a Hasselblad camera #Midjourney
Hashtags
@AIArtsGallery · Post #8640 · 09.04.2026 г., 06:32
A full-body portrait of a cute and elegant korean woman A full-body portrait of a cute and elegant korean woman, looking slightly shy, wearing a short skirt, riding a bicycle slowly under soft pink cherry blossoms, gentle spring sunlight glowing on her skin, focus on the woman with shallow depth of field (background softly blurred), subtle motion in her hair and skirt, cinematic composition, ultra-realistic, highly detailed, 8k, sharp focus on the face #Midjourney
Hashtags
@AIArtsGallery · Post #8636 · 08.04.2026 г., 06:33
A young woman warlock holding two grimoires and reciting spells aloud a young woman warlock holding two grimoires and reciting spells aloud. High fantasy, high/res, in the art style of magic the gathering #Midjourney
Hashtags
@AIArtsGallery · Post #8632 · 07.04.2026 г., 06:32
Young adult cheerleader jogging lightly on a sports field young adult cheerleader jogging lightly on a sports field, white and gold cheer top and shimmering gold skirt, bright natural smile, hair moving in the wind, mid-length vertical action portrait, athletic field softly blurred in the background, clear directional daylight, lively school sports energy, luminous skin, reflective gold fabric accents, clean whites, realistic light movement, shallow depth of field, clean Kodak color negative palette, nostalgic Kodak 35mm photography, cinematic lighting, soft highlight glow, subtle film grain, gentle contrast, rich shadow detail #Midjourney
Hashtags
@AIArtsGallery · Post #8628 · 06.04.2026 г., 06:30
1 girl, back view, pink hair in a single ponytail masterpiece, best quality, ultra-detailed, 8K resolution, HDR, high contrast, cinematic lighting, soft light effect, realistic anime 3D rendering, oil painting fantasy style, oil painting texture, ethereal dreamy atmosphere, 1 girl, back view, pink hair in a single ponytail, hair strands fluttering in the wind, white sailor-style short top (dark trim on cuffs), dark pleated JK skirt, white lace ribbon mid-calf socks, black platform leather shoes, dynamic walking pose, skirt fluttering in the wind, left arm slightly outstretched, standing on cobblestone path in front of a grand fantasy castle, foreground dotted with climbing rose bushes, mossy stone lanterns and weathered castle steps, middle ground: towering Gothic-style castle complex with spires, battlements and a moat with lily pads, sky with huge blue-white gradient liquid cloud vortex, sunlight piercing vortex center creating crepuscular rays, floating glowing particles, soft magenta-purple highlights on vortex edge, ultra-wide angle lens, slight fisheye distortion, low-angle shot, asymmetric composition, cobblestone path and castle spire outlines leading to sky vortex, visual focus on sky vortex with character as foreground anchor, background bokeh, sharp focus on character and foreground details, ethereal mood, sense of longing and adventure #Midjourney
Hashtags