str_encode#

utility functions for string encoding.

pathlib_mate.str_encode.encode_hexstr(text)[source]#

Convert any utf-8 string to hex string.

Return type:

str

Example:

>>> encode_hexstr("/home/your_username")
2f686f6d652f796f75725f757365726e616d65

中文文档

将任意 utf-8 字符串编码为 16 进制字符串。

pathlib_mate.str_encode.decode_hexstr(text)[source]#

Reverse operation of encode_hexstr().

Return type:

str

中文文档

将 16 进制字符串解码为原字符串。