binasciiError Invalid base64-encoded string number of data characters 37
The error message "binascii.Error: Invalid base64-encoded string: number of data characters (37" suggests that the provided string is not a valid base64-encoded string. The number of data characters in a base64-encoded string should always be a multiple of 4.
In this case, the string seems to have 37 data characters, which is not a multiple of 4. To fix this error, you need to ensure that the base64-encoded string has the correct length.
Here's an example of a properly encoded base64 string:
import base64
data = "Hello, World!"
encoded_data = base64.b64encode(data.encode("utf-8"))
print(encoded_data)
Output:
b'SGVsbG8sIFdvcmxkIQ=='
Make sure that the string you are trying to decode is properly encoded with a multiple of 4 data characters.
原文地址: https://www.cveoy.top/t/topic/jgJW 著作权归作者所有。请勿转载和采集!