2
I receive through a requisition json one request.POST
that comes as a list of string Base64.
I can convert to string with str(request.POST['imagem'])
what results something like this:
['eJzFnemyozqwpQXeNdz7/i/bHWXTP7zTXiy+lZKrTkQrwmHQkJNyATYfv36dWzHGGPfxhhjPB6P', ...]
With the AST library on any other list of the same type I can convert to a list of python with: ast.literal_eval(list_string)
, but when it comes with Base64 inside the list, it gives syntax error:
File "", line 2 eJzFnemyozqwpQXeNdz7/i/bHWXTP7zTXiy+lZKrTkQrwmHQkJNyATYfv36dWzHGGPfxhhjPB6P Syntaxerror: invalid syntax
Any idea?
How to convert this to a usable list of python?
import base64 
base64.b64decode(coded_string)
. Please try this way– Miguel