2025-09-10:仓库迁移

This commit is contained in:
2025-09-10 16:12:45 +08:00
parent e0e49b0ac9
commit 3130e336a1
146 changed files with 4066 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
import base64, binascii
if __name__ == '__main__':
s = b'Hello World!'
# 将字节串以十六进制编码
h = binascii.b2a_hex(s)
print(h)
# 将数据从十六进制解码成字节串
b = binascii.a2b_hex(h)
print(b)
# 同理在熟悉的base64模块我们也能实现同样的功能
h = base64.b16encode(s)
print(h)
b = base64.b16decode(h)
print(b)
# 个人感觉base64的API更加干净
# 对了如果想要将数据以unicode输出可以使用一次decode
print(h.decode('ascii'))