When adding a dictionary to the test list with

 test.append('{"name": "' + name+ '", "number":"' + number + '}') 

it turns out that a string is added, not a dictionary.

    2 answers 2

    Because you are adding a string, not a dictionary.

     test.append({'name': name, 'number': number}) 

      You must first create a dictionary and then add it to the list using .append() .

       a = [] b = { 'c': 1, 'd': 2 } a.append(b) 

      Thus, several dictionaries can be added to one list.