python b64decode.decode
时间: 2023-10-19 20:34:37 浏览: 97
base64decode
`b64decode` is a method in the `base64` module in Python. It is used to decode a Base64 encoded string back into its original form.
Here's an example of how you can use it:
```python
import base64
encoded_string = "SGVsbG8gV29ybGQh" # Base64 encoded string
decoded_bytes = base64.b64decode(encoded_string) # Decode the string
decoded_string = decoded_bytes.decode('utf-8') # Convert bytes to string
print(decoded_string) # Output: "Hello World!"
```
In the above example, the `b64decode` function decodes the `encoded_string` variable, which contains a Base64 encoded string, into bytes. The `decode` method is then used to convert those bytes back into a string using the 'utf-8' encoding. The resulting decoded string is then printed.
阅读全文