Stefan Behnel wrote: > [EMAIL PROTECTED] wrote: >> 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. > > I do not quite know what you could possibly need that for, but AFAICT > Python only uses two different unicode encodings depending on the > platform.
It is very important for relational databases, as these usually constrain the amount of bytes per column - so you need the size of bytes, not the number of unicode characters. Diez -- http://mail.python.org/mailman/listinfo/python-list