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

Резултати

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

Пребарај: #yeah

当前筛选 #yeah清除筛选
Mountstorm notes

@mountstorm · Post #653 · 16.07.2023 г., 04:16

That Eye Blunt Injury The incident of a blunt eye injury during a football game caused me to spend a week alone in the hospital, which led to the discovery of my sense of self. I associate mostly with being a student, as I have always been passionate about learning and developing my knowledge. However, the experience of the injury made me realize that being cautious and aware of my surroundings is also a defining part of my identity. As a student, I am constantly learning and growing, but as someone who has suffered an injury, I am also aware of my vulnerability. This experience has taught me to be more careful and attentive in my day-to-day life, especially when participating in physical activities. Overall, the experience has helped me to redefine my identity and to appreciate the importance of taking care of myself. #yeah

Hashtags

Mountstorm notes

@mountstorm · Post #170 · 30.05.2022 г., 08:15

Summer. High School graduates still have the aftertaste of the graduation party and now are preoccupied with summer holidays. While my bro, a 9th grade graduate, can chill for the entire season, he will work on his academic interests and chill. Along with participating in extracurricular summer programs, he will be reading books, however cliche it sounds. Reading a book is like investing in real-estate. As long as you get the right book/estate, you are in a slowly-but-surely growing business. No need for a solid schedule or a measurable goal - how many pages to read daily, specific deadlines - in the beginning. Planning is important, I'd say, when and if there is already a vivid picture of what exactly you need and want to read. I started the process with whatever I had in hand - a fairy-tale collection, a magazine, or a random novel. Bit by bit, it's been getting more clear what genre/author's style is mine and what book to read next. The difference between a "good" book and a "bad" one for me is the first ten pages. Asking for advice on what to read from others is also better done in later stages, I believe. Suggested books are better added to the foundation laid by you. #yeah

Hashtags

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