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 слични објави

Пребарај: #ipprivacy

当前筛选 #ipprivacy清除筛选
Venture Village Wall 🦄

@venturevillagewall · Post #4189 · 19.02.2025 г., 10:00

New Developments in Tech and Crypto 🔸 MTS warns of risks due to the Russian government's IP data collection project. Read more 🔸 In Irkutsk, household electricity consumption spikes due to gray miners amid a mining ban and rising Bitcoin prices. Read more 🔸 Russian streaming services reportedly revive talks with Hollywood for content return, but no confirmations yet. Read more 🔸 Latest Telegram update includes conference interface for iOS users. Read more 🔸 Ex-CTO of OpenAI, Mira Murati, launches new AI startup, Thinking Machines Lab, focused on user-friendly AI adaptation. Read more 🔸 Intel stocks surge 16% amid rumors of a possible company split. Read more 🔸 Niantic, creator of Pokemon Go, aims to sell gaming business for $3.5 billion due to lack of success in replicating previous hits. Read more 🔸 Bitcoin ownership shifts: Private investors sold 525,000 BTC while institutional investors increased holdings by 374,000 BTC. source 🔸 Controversy in crypto space: Solana faces reputation challenges as scandals arise. More info #MTS#IPPrivacy#Bitcoin#Telegram#AI#OpenAI#Intel#Niantic#Crypto#Solana#Investment#B2B#ETFs#DataAnalysis#Tech#Gaming#Ecosystem#MarketTrends#Startups#VentureCapital#VC#Innovation