figuring out # of bytes

Irmen de Jong irmen.NOSPAM at xs4all.nl
Fri Apr 22 16:39:55 EDT 2005


codecraig wrote:
> i want to the number of bytes in a string...
> 
> is, len(x) accurate?
> 
> so, x = "hi"
> len(x) == 2 ....so that means two bytes?
> 
> thanks
> 

As long as type(x)==str, this is correct.

--Irmen



More information about the Python-list mailing list