Determine size of string in bytes

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Mar 27 16:40:49 EDT 2008


En Thu, 27 Mar 2008 16:45:52 -0300, breal <hacker.stevenson at gmail.com>  
escribió:

> Forgive me for this question which is most likely stupid...
>
> How do I determine the number of bytes a string takes up?  I have a
> soap server that is returning a serialized string.  It seems that when
> the string goes over 65978 characters it does not return to the soap
> client.  Instead I get an error:
> error: (35, 'Resource temporarily unavailable')

len(x)?
Or do you wan to know how many bytes will have an unicode object when  
encoded in a certain encoding? The only way is to actually encode it and  
take the length.

-- 
Gabriel Genellina




More information about the Python-list mailing list