Python Base64 解密脚本 - 简单易用
以下是一个使用 Python 编写的 Base64 解密脚本示例:
import base64
# 输入要解密的 Base64 字符串
encoded_str = input('请输入要解密的 Base64 字符串:')
# 将字符串转换为 bytes 类型
encoded_bytes = encoded_str.encode('utf-8')
# 解码 Base64 字符串
decoded_bytes = base64.b64decode(encoded_bytes)
# 将 bytes 类型转换为字符串类型
decoded_str = decoded_bytes.decode('utf-8')
# 输出解密结果
print('解密结果为:', decoded_str)
使用方法:
- 打开 Python 解释器,将以上代码复制到解释器中。
- 运行代码。
- 输入要解密的 Base64 字符串,按回车键。
- 程序将输出解密结果。
注意:
如果要解密的字符串中含有特殊字符,例如加号 '+',需要将其替换为 URL 安全的字符 '-'。
原文地址: https://www.cveoy.top/t/topic/l2Yf 著作权归作者所有。请勿转载和采集!