Python 解码 Base64 编码文件:十六进制转码与 Base64 解码
import base64
with open('base64.txt', 'r') as f: hex_string = f.read().strip() # 读取文件内容并去除空白字符 decoded_hex = bytes.fromhex(hex_string) # 将十六进制字符串转换为字节串 decoded_bytes = base64.b64decode(decoded_hex) # 进行base64解码 decoded_string = decoded_bytes.decode('utf-8') # 将字节串转换为字符串 print(decoded_string) # 输出解码后的字符串
原文地址: https://www.cveoy.top/t/topic/mjIB 著作权归作者所有。请勿转载和采集!