icalendar.parser_tools module#
- icalendar.parser_tools.data_encode(data, encoding='utf-8')[source]#
Encode all datastructures to the given encoding.
Currently Unicode strings, dicts, and lists are supported.
- Parameters:
data (
str|bytes|dict|list) – The datastructure to encode.- Return type:
bytes|list[bytes] |dict
- icalendar.parser_tools.from_unicode(value, encoding='utf-8')[source]#
Converts a value to bytes, even if it is already bytes.
- Parameters:
value (
str|bytes) – The value to convert.encoding (
str) – The encoding to use in the conversion.
- Return type:
bytes- Returns:
The bytes representation of the value.