title: Adding "sequential" information to python list using dictionaries
body: <h2>The problem</h2>
  <p>I would like to create a dictionary of dicts out of a flat list I have in order to add a &quot;sequentiality&quot; piece of information, but I am having some trouble finding a solution.</p>
  <p>The list is something like</p>
  <pre><code>a = ['Q=123', 'W=456', 'E=789', 'Q=753', 'W=159', 'E=888']
  </code></pre>
  <p>and I am shooting for a <code>dict</code> like:</p>
  <pre><code>dictionary = {
      'Step_1': {
          'Q=123', 
          'W=456', 
          'E=789'
      },
      'Step_2': {
          'Q=753', 
          'W=159', 
          'E=888'
      }
  }
  </code></pre>
  <p>I would like to end up with a function with an arbitrary number of <code>Steps</code>, in order to apply it to my dataset. Suppose that in the dataset there are lists like <code>a</code> with 1 &lt;= n &lt;6 <code>Steps</code> each.</p>
  <h2>My idea</h2>
  <p>Up to now, I came up with this:</p>
  <pre><code>nsteps = a.count(&quot;Q&quot;)
  data = {}
  for i in range(nsteps):
      stepi = {}
      for element in a:
              new = element.split(&quot;=&quot;)
              if new[0] not in stepi:
                  stepi[new[0]] = new[1]
              else:
                  pass
      data[f&quot;Step_{i}&quot;] = stepi
  </code></pre>
  <p>but it doesn't work as intended: both steps in the final dictionary contain the data of <code>Step_1</code>.
  Any idea on how to solve this?</p>