I have a list containing several dicts. I want to store each of these dicts in a separate variable.
The data is something like:
my_list = [{'key': 'value'}, {'key' : 'value'}]
I have tried the following code.
for i in range(len(data)):
string = 'ticket' + str(i)
exec('eval(string) = data[i]')
However, when I run the code, it gives me the error can't assign to function call. Is there any way to get it to evaluate string and assign to that? I want it to execute something like this:
ticket1 = data[1]