Consider the following Python code:
payload = """{"id": "866425038985380","ts": "2020-05-07T13:16:51.350Z"}"""
ascii_message = payload.encode('ascii')
encoded_payload = base64.b64encode(ascii_message)
string_payload = str(encoded_payload)
print(string_payload)
print(type(encoded_payload))
When I print the lines above, my output is:
b'eyJpZCI6ICI4NjY0MjUwMzg5ODUzODAiLCJ0cyI6ICIyMDIwLTA1LTA3VDEzOjE2OjUxLjM1MFoifQ=='
<class 'bytes'>
Is it possible to get a string equivalent of the encoded result? In particular, how can I get this:
'eyJpZCI6ICI4NjY0MjUwMzg5ODUzODAiLCJ0cyI6ICIyMDIwLTA1LTA3VDEzOjE2OjUxLjM1MFoifQ=='
I'd like to set that to a new variable without the b
in front and for it to type string.