title: Python: Convert table to string to key:value pairs and store in nested dict using comprehension
body: <p>I received data from a subprocess command as a string. I want to store this data in a nested dict using dictionary comprehension. How do I do this? Note: Table rows and columns will vary for each subprocess command.</p>
  
  <p>This is only an example: (I have returned this as a string from subprocess.)</p>
  
  <pre><code>NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
  loop0     7:0    0 140.7M  1 loop /snap/gnome-3-26-1604/82
  loop1     7:1    0  89.3M  1 loop /snap/core/6673
  sda       8:0    0    11G  0 disk 
  ├─sda1    8:1    0  10.9G  0 part /
  ├─sda14   8:14   0     4M  0 part 
  └─sda15   8:15   0   106M  0 part /boot/efi
  </code></pre>
  
  <p>Here is the output I want:</p>
  
  <pre><code>{block device 1: 
      { "name" :  value,
      "maj:min" : value,
      "RM" : value,
      "SIZE" : value,
      "RO": value,
      "TYPE": value,
      "MOUNTPOINT" : value},
   block device 2: 
       { "name" :  value,
      "maj:min" : value,
      "RM" : value,
      "SIZE" : value,
      "RO": value,
      "TYPE": value,
      "MOUNTPOINT" : value},
  ...
  }
  </code></pre>
  
  <p>Here is the method I am using to sort this (it's nasty, I know). </p>
  
  <pre><code>def multiple_column_dict(a_string, cat):
  
      lines = re.split("\n", a_string)
      keys = re.split(" +", lines[0])
  
      values1 = re.split(" +", lines[1])
      values2 = re.split(" +", lines[2])
      values3 = re.split(" +", lines[3])
      values4 = re.split(" +", lines[4])
      values5 = re.split(" +", lines[5])
      values6 = re.split(" +", lines[6])
  
      a_dict1 = dict(zip(keys, values1))
      a_dict2 = dict(zip(keys, values2))
      a_dict3 = dict(zip(keys, values3))
      a_dict4 = dict(zip(keys, values4))
      a_dict5 = dict(zip(keys, values5))
      a_dict6 = dict(zip(keys, values6))
  </code></pre>