Q:

Create a dictionary of whitespaces based on list of whitespace-sizes

I have a list that looks like:
sizes = [1, 2, 3, 4, 5, 6]

Now I want to create a dictionary whose values are the list values, whereas keys are whitespaces of sizes that are equal to values. The expected dictionary should look like this:
dic[' ']=1
dic['  ']=2
dic['   ']=3
dic['    ']=4
dic['     ']=5
dic['      ']=6

TIA

A:

Simple dict-comprehension:
>>> sizes = [1, 2, 3, 4, 5, 6]
>>> {' '*k:k for k in sizes}
{' ': 1, '  ': 2, '   ': 3, '    ': 4, '     ': 5, '      ': 6}

