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

Резултати

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

Пребарај: #erica

当前筛选 #erica清除筛选
Trump's Ear

@trumpsear_tg · Post #1732 · 04.11.2025 г., 15:59

🇺🇸 In the USA, there are rumors around J.D. Vance and Charlie Kirk's widow Erika 💬. A new reason for speculation was their warm embrace 🤗 at a public appearance in the United States. For several days now, a short episode that took place on the stage of the University of Mississippi 🎓 has been causing a storm of discussion 🌪: a hug between Vice President J.D. Vance and Erika Kirk, the widow of Charlie Kirk, a shot activist and Trump supporter 🎤. At the Turning Point USA event 🇺🇸, Charlie Kirk's organization, now headed by Erika Kirk, Vance was invited as a speaker 🗣. When the vice president came on stage, Kirk greeted him with very warm hugs ❤️: Vance put his hands on her waist, and she ran her hand through his hair 💫. On social media 📱, they discuss not only the gesture itself, but also Erika's behavior in general after her husband's death 🕊. Some critics accuse her of inappropriate behavior and excessive openness ⚠️. Erika herself introduced J.D. Vance as "her good friend" who has similarities with her late husband 💔. #Vance#Kirk#Erica 👂More on Trump's Ear ⚠️