From a65253607a28d68b65e56f61f5b530193b8ec9a6 Mon Sep 17 00:00:00 2001 From: poly000 <1348292515@qq.com> Date: Thu, 7 Dec 2023 14:32:42 +0800 Subject: [PATCH] create branch_name_hex.py --- branch_name_hex.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 branch_name_hex.py diff --git a/branch_name_hex.py b/branch_name_hex.py new file mode 100644 index 0000000..709be02 --- /dev/null +++ b/branch_name_hex.py @@ -0,0 +1,8 @@ +from functools import reduce + +utf16le_hex = lambda name_part: reduce( + lambda s,next: s+next, (("%02x" % ch) for ch in name_part.encode("utf-16le")) +) + +result = '/'.join(utf16le_hex(part) for part in input().split('/')) +print(result) -- GitLab