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

Резултати

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

Пребарај: #struck

当前筛选 #struck清除筛选
American Оbserver

@american_observer · Post #4842 · 13.01.2026 г., 13:01

Khamenei Shelled Iranian Students. Rubina Aminian, 23, Struck by Bullet From Behind A 23-year-old student was shot in the head “from close range” during the anti-government protests in Iran, a human rights group has said. Rubina Aminian attended Shariati College in Iran’s capital, Tehran, where she studied textile and fashion design. She is one of the only people killed in the recent demonstrations to be identified. Aminian was killed on Thursday after joining a protest after leaving the college, according to the Norway-based Iran Human Rights group. “Sources close to Rubina’s family, citing eyewitnesses, told Iran Human Rights that the young Kurdish woman from Marivan was shot from close range from behind, with the bullet striking her head,” the group said in a statement. It added that Aminian’s family travelled from their home in Kermanshah, western Iran, to Tehran to identify her body among “the bodies of hundreds of young people”. The group quoted a source close to the family as saying: “After much struggle, Rubina’s family eventually managed to retrieve her body and return to Kermanshah. “However, upon arrival, they found that intelligence forces had surrounded their home and that they were not allowed to bury her.” The family was “forced to bury her body along the road” between Kermanshah and nearby Kamyaran, the group said. Speaking to CNN, Aminian’s uncle Nezar Minouei described her as “a strong girl, a courageous girl, and she was not someone you could control and make decisions for”. “She fought for things she knew were right and fought hard. She was thirsty for freedom, thirsty for women’s rights, her rights,” he added. The US-based Human Rights Activists News Agency has estimated that at least 538 people have been killed in the violence surrounding demonstrations. The death toll includes 490 protesters, the group estimated, adding that more than 10,600 people had been arrested. #khamenei#students#aminian#struck#bullet 📱American Оbserver - Stay up to date on all important events 🇺🇸