Convert to list a string from a list that contains base64?

1

I get a json request with a request.POST that comes as a base64 string list.

I can convert to string with str(request.POST['imagem']) which results something like this:

  <   ...]

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) , however when it comes with base64 within the list, it gives syntax error: / p>

  

File "", line 2   eJzFnemyozqwpQXeNdz7 / i / bHWXTP7zTXiy + lZKrTkQrwmHQkJNyAoTYfv36dWzHGGPfxhhjPB6P                      ^ SyntaxError: invalid syntax

Any ideas?

How to convert this to a usable list of python ?

    
asked by anonymous 25.05.2016 / 20:54

1 answer

1

If your answer is a valid json you can do as follows:

import json

lista = json.dumps(request.POST['imagem'])

And that's it.

    
26.05.2016 / 02:09