Python Base64 编码器:快速计算 Base64 字符串
import base64
def calculate_base64(input_string): # 将输入字符串编码为bytes类型 input_bytes = input_string.encode('utf-8')
# 将bytes类型的字符串进行base64编码
encoded_bytes = base64.b64encode(input_bytes)
# 将编码后的bytes类型转换为字符串
encoded_string = encoded_bytes.decode('utf-8')
return encoded_string
测试
input_string = "Hello World!" result = calculate_base64(input_string) print(result)

原文地址: http://www.cveoy.top/t/topic/pPN0 著作权归作者所有。请勿转载和采集!