TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #242 · 7 мај

Теперь запакуем строку. В этом случае следует передавать тип данных bytes. >>> struct.pack('=s', b'a') b'a' Для записи слова следует указывать количество символов. >>> struct.pack('=5s', b'hello') b'hello' Кстати, запакованный вид соответствует исходному тексту. Всё верно, символ есть в таблице ASCII, то есть его код попадает в диапазон 0-127, он может быть записан одним байтом и имеет визуальное представление. А вот что будет если добавить символ вне ASCII >>> struct.pack(f'=s', b'ё') SyntaxError: bytes can only contain ASCII literal characters. Ошибка возникла еще на этапе создания объекта bytes, который не может содержать такой символ. Поэтому надо кодировать эти байты из строки. >>> enc = 'ёжик'.encode('utf-8') >>> struct.pack(f'={len(enc)}s', enc) b'\xd1\x91\xd0\xb6\xd0\xb8\xd0\xba' Заметьте, длина такой строки в байтах отличается от исходной длины, так как символы вне ASCII записываются двумя байтами и более. Поэтому здесь формат создаём на лету, используя получившуюся длину как каунтер токена. #libs#basic

Hashtags

Резултати

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

Пребарај: #dunes

当前筛选 #dunes清除筛选
Amazing Geography 🌍

@amazingeo · Post #656 · 09.03.2026 г., 20:31

🌍 Libya’s Libyan Desert holds sand seas with dunes reaching up to 180 meters tall. These giant dunes constantly shift with the wind, creating landscapes that can look completely different in just a few years. ✨ #desert⚡#dunes⚡#arid⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #274 · 20.09.2025 г., 19:31

🌍 In the Taklamakan Desert of China, some sand dunes reach up to 300 meters tall. Shifting winds keep these giant dunes moving, constantly reshaping the landscape year after year. ✨ #deserts⚡#dunes⚡#arid⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography🌍 ​

Amazing Geography 🌍

@amazingeo · Post #354 · 10.10.2025 г., 12:31

🌍 In Australia’s Simpson Desert, certain red sand dunes can “move” up to a meter each year as winds slowly push millions of grains, gradually shifting entire hills across the arid landscape. ✨ #deserts⚡#dunes⚡#Australia⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #505 · 10.12.2025 г., 12:31

🌍 The world's highest coastal dune towers 352 meters above sea level at Pilat Dune in France. This massive sand formation shifts yearly as Atlantic winds pile new layers along the shore. ✨ #seacoast⚡#dunes⚡#landscape⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #391 · 19.10.2025 г., 15:31

🌍 The Namib Sand Sea is the only coastal desert made entirely of shifting sand dunes recognized as a UNESCO World Heritage site, with winds constantly sculpting waves of sand along the Atlantic coast. ✨ #desert⚡#dunes⚡#Namibia⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​