Make array from Requests.get in python
Question: I Do the following :

    
    
    @app.route('/api/test/', methods=['GET'])
    def catalogue1():
     cache = []
     r = requests.get("http://192.168.198.140:5000/api/listdir")
     cache = r.content
    

cache = ["vagrant.txt", "Securite_sociale.jpg"] ;

when i try to print cache[0] i get "[" .

How can i transform this result to an array .


Answer: I know nothing about Flask but it looks like `r.content` is a string, yet to
be de-serialized into a Python list. e.g. rather than

    
    
    cache = ["vagrant.txt", "Securite_sociale.jpg"]
    

you have:

    
    
    cache = '["vagrant.txt", "Securite_sociale.jpg"]' 
    

I'm presuming it's JSON, in which case you could fix this with

    
    
    import json
    cache = json.loads(r.content)
    

But I'm also presuming there's a built-in way to do this in Flask

