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

Резултати

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

Пребарај: #phrases

当前筛选 #phrases清除筛选
English From Zero to Hero

@Learn_English_from_Zero_to_Hero · Post #60764 · 08.05.2026 г., 18:02

#phrases 💥Shallow matters ⚜The term "shallow matters" refers to topics, discussions, or concerns that lack depth, seriousness, or significance. They are often superficial and do not engage with deeper issues or complexities. ⚜While many people were debating the impact of climate change, Sarah seemed more interested in the shallow matters of which celebrity was dating whom."

Hashtags

English From Zero to Hero

@Learn_English_from_Zero_to_Hero · Post #60754 · 03.05.2026 г., 20:58

#Phrases 💢To cry out for 💠To be in desperate need of something 📝Note:- 📝 the subject is generally not a person, but an organisation, object or situation 🌀 Example:- A:- This room is crying out for some colour and modern furnishing. I suggested subtle green wallpaper, but it didn’t register with Jenny. On second thoughts, maybe red? B:- RED? You've definitely got a screw loose.

Hashtags

English From Zero to Hero

@Learn_English_from_Zero_to_Hero · Post #60753 · 03.05.2026 г., 20:58

#Phrases 💢 A chink in one’s armour 💠One small weakness in a person or their argument which makes them open to attack or criticism 🌀 Example:- Our lawyers have been sifting through the evidence but cannot find a chink in the defending company’s armour. It’s no wonder they are being very woolly on how they intend to present our case in court.

Hashtags

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