Convert Utility

The convert utility functions can convert unicode strings into byte sequences and vice versa. Independent of the Python version used, they ensure a string (as seen by the convert utilities) is always a unicode string, and a byte sequence (as seen by the convert utilities) is always a sequence of bytes, and not a multi-byte sequence.

xobox.utils.convert.to_bytes(value)[source]

Convert any value into a byte sequence.

Parameters:value – The value to be converted
Returns:Byte sequence
xobox.utils.convert.to_str(value)[source]

Convert any value into a unicode string.

Parameters:value – The value to be converted
Returns:Resulting string