Aaron Brady wrote: >>> Otherwise you can't know its length or change its reference count. >> The internal representation of Python byte strings is 0 terminated, so >> strlen() will work. > > As MRAB said, Python strings can contain null bytes,
Sure, they can. Most byte strings I've seen didn't, though. And if you know that they don't contain any null bytes (UTF-8 serialised XML, for example, or ASCII encoded text, or ...), 's' is just fine. If you need content *and* length, use 's#'. Matter of use case, as usual. Stefan -- http://mail.python.org/mailman/listinfo/python-list