用python写一个base64解码的脚本
时间: 2023-05-11 11:03:59 浏览: 342
可以使用Python内置的base64模块来解码base64编码的字符串,以下是一个示例代码:
```python
import base64
encoded_str = "SGVsbG8gV29ybGQh"
decoded_str = base64.b64decode(encoded_str).decode('utf-8')
print(decoded_str)
```
输出结果为:
```
Hello World!
```
这段代码将base64编码的字符串`"SGVsbG8gV29ybGQh"`解码为`"Hello World!"`。
相关问题
用python生成一个base64解码脚本
以下是使用Python编写的Base64解码脚本示例:
```python
import base64
encoded_string = input("Enter the Base64 encoded string: ")
decoded_string = base64.b64decode(encoded_string)
print("Decoded String: ", decoded_string.decode('utf-8'))
```
在运行脚本时,用户必须输入一个Base64编码的字符串。然后,该脚本使用Python内置的base64模块解码该字符串并打印出解码后的字符串。
用python写base64的解码脚本
好的,关于python写base64的解码脚本,你可以在Python标准库中使用base64模块,代码如下:
import base64
encoded_text = "aGVsbG8gd29ybGQ="
decoded_text = base64.b64decode(encoded_text).decode("utf-8")
print(decoded_text)
这段代码会将经过base64编码后的字符串“aGVsbG8gd29ybGQ=”进行解码,输出为“hello world”。
接下来,请问您还有其他问题吗?