figuring out # of bytes
Fredrik Lundh
fredrik at pythonware.com
Mon Apr 25 10:34:11 EDT 2005
"codecraig" wrote:
> so each character in the string is 1 byte? if so, can u point me to
> somewhere that states that perhaps?
the documentation, perhaps?
http://www.python.org/doc/ref/types.html
Strings
The items of a string are characters. There is no separate
character type; a character is represented by a string of one
item. Characters represent (at least) 8-bit bytes. The built-in
functions chr() and ord() convert between characters and
nonnegative integers representing the byte values. Bytes
with the values 0-127 usually represent the corresponding
ASCII values, but the interpretation of values is up to the
program. The string data type is also used to represent
arrays of bytes, e.g., to hold data read from a file.
</F>
More information about the Python-list
mailing list