how to get size of unicode string/string in bytes ?
pattreeya at gmail.com
pattreeya at gmail.com
Tue Aug 1 04:36:14 EDT 2006
e.g. I use utf8 as encoding/decoding,
s = "ทดสอบ"
u = s.decode("utf-8")
how can I get size of u ?
pattreeya at gmail.com schrieb:
> Hello,
>
> how can I get the number of byte of the string in python?
> with "len(string)", it doesn't work to get the size of the string in
> bytes if I have the unicode string but just the length. (it only works
> fine for ascii/latin1) In data structure, I have to store unicode
> string for many languages and must know exactly how big of my string
> which is stored so I can read back later.
>
> Many thanks for any suggestion.
>
> cheers!
> pattreeya.
More information about the Python-list
mailing list