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

Резултати

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

Пребарај: #wales

当前筛选 #wales清除筛选
Anarcho Gardening

@anarchogardening · Post #3171 · 26.03.2026 г., 14:27

Good idea: trees instead of barriers https://www.bbc.com/news/articles/cqxdxg7j3qgo After that devastating day, a group of villagers came together with an idea - they would plant trees, thousands of them, to try to reduce the risk of flooding in the future. Trees and woods play a "vital" role in reducing flooding by slowing down the flow of rainwater, absorbing rainwater and reducing erosion, according to the Woodland Trust. #trees , #floods, #wales https://ieji.de/@MinistryOfGoodIdeas/116283802113284702

AI match predictions

@ai_match_prediction · Post #11187 · 26.03.2026 г., 09:05

World Cup - Qualification Europe🌍 2026-03-26 17:00 UTC Türkiye vs. Romania Predicted outcome: Türkiye✅ Predicted score: 3:1 Actual: Türkiye 1:0 #Turkey#Romania 2026-03-26 19:45 UTC Denmark vs. FYR Macedonia Predicted outcome: Denmark✅ Predicted score: 3:1 Actual: Denmark 4:0 #Denmark#Macedonia 2026-03-26 19:45 UTC Poland vs. Albania Predicted outcome: Poland✅ Predicted score: 1:0 Actual: Poland 2:1 #Poland#Albania 2026-03-26 19:45 UTC Wales vs. Bosnia & Herzegovina Predicted outcome: Wales❌ Predicted score: 3:2 Actual: Draw 1:1 #Wales#BosniaandHerzegovina 2026-03-26 19:45 UTC Italy vs. Northern Ireland Predicted outcome: Italy✅ Predicted score: 2:1 Actual: Italy 2:0 #Italy#NorthernIreland 2026-03-26 19:45 UTC Czech Republic vs. Rep. Of Ireland Predicted outcome: Czech Republic❌ Predicted score: 1:0 Actual: Draw 2:2 #CzechRepublic#RepublicofIreland 2026-03-26 19:45 UTC Ukraine vs. Sweden Predicted outcome: Draw❌ Predicted score: 2:2 Actual: Sweden 1:3 #Ukraine#Sweden 2026-03-26 19:45 UTC Slovakia vs. Kosovo Predicted outcome: Draw❌ Predicted score: 1:1 Actual: Kosovo 3:4 #Slovakia#Kosovo #Football#WorldCup

AI match predictions

@ai_match_prediction · Post #11224 · 31.03.2026 г., 01:05

Friendlies🏳 2026-03-31 17:30 UTC South Africa vs. Panama Predicted outcome: South Africa❌ Predicted score: 2:1 Actual: Panama 1:2 #SouthAfrica#Panama 2026-03-31 17:30 UTC Jordan vs. Nigeria Predicted outcome: Nigeria❌ Predicted score: 1:2 Actual: Draw 2:2 #Jordan#Nigeria 2026-03-31 18:00 UTC Peru vs. Honduras Predicted outcome: Peru❌ Predicted score: 2:1 Actual: Draw 2:2 #Peru#Honduras 2026-03-31 18:00 UTC Morocco vs. Paraguay Predicted outcome: Morocco✅ Predicted score: 2:0 Actual: Morocco 2:1 #Morocco#Paraguay 2026-03-31 18:00 UTC Guinea vs. Benin Predicted outcome: Draw❌ Predicted score: 1:1 Actual: Benin 0:1 #Guinea#Benin 2026-03-31 18:30 UTC Scotland vs. Ivory Coast Predicted outcome: Draw❌ Predicted score: 1:1 Actual: Ivory Coast 0:1 #Scotland#IvoryCoast 2026-03-31 18:30 UTC Algeria vs. Uruguay Predicted outcome: Algeria❌ Predicted score: 2:0 Actual: Draw 0:0 #Algeria#Uruguay 2026-03-31 18:45 UTC England vs. Japan Predicted outcome: England❌ Predicted score: 1:0 Actual: Japan 0:1 #England#Japan 2026-03-31 18:45 UTC Ukraine vs. Albania Predicted outcome: Albania❌ Predicted score: 1:2 Actual: Ukraine 1:0 #Ukraine#Albania 2026-03-31 18:45 UTC Austria vs. South Korea Predicted outcome: Draw❌ Predicted score: 1:1 Actual: Austria 1:0 #Austria#SouthKorea 2026-03-31 18:45 UTC Netherlands vs. Ecuador Predicted outcome: Draw✅ Predicted score: 1:1 Actual: Draw 1:1 #Netherlands#Ecuador 2026-03-31 18:45 UTC Wales vs. Northern Ireland Predicted outcome: Draw✅ Predicted score: 1:1 Actual: Draw 1:1 #Wales#NorthernIreland 2026-03-31 18:45 UTC Slovakia vs. Romania Predicted outcome: Slovakia✅ Predicted score: 3:1 Actual: Slovakia 2:0 #Slovakia#Romania 2026-03-31 18:45 UTC Rep. Of Ireland vs. FYR Macedonia Predicted outcome: Rep. Of Ireland❌ Predicted score: 2:0 Actual: Draw 0:0 #RepublicofIreland#Macedonia 2026-03-31 19:00 UTC Spain vs. Egypt Predicted outcome: Spain❌ Predicted score: 1:0 Actual: Draw 0:0 #Spain#Egypt 2026-03-31 19:00 UTC Senegal vs. Gambia Predicted outcome: Senegal✅ Predicted score: 5:1 Actual: Senegal 3:1 #Senegal#Gambia 2026-03-31 19:00 UTC Burkina Faso vs. Guinea-Bissau Predicted outcome: Burkina Faso❌ Predicted score: 2:0 Actual: Draw 1:1 #BurkinaFaso#GuineaBissau 2026-03-31 19:00 UTC Brazil U20 vs. Paraguay U20 Predicted outcome: Brazil U20✅ Predicted score: 3:1 Actual: Brazil U20 3:1 #BrazilU20#ParaguayU20 #Football#Friendlies