title: How do I create specific tuples from a column of values?
body: <p>I want to make a tuple that looks like this:</p>
  <pre><code>t = (
      (&quot;Type:&quot;, &quot;Security Server&quot;),
      (&quot;Type:&quot;, &quot;Primary Domain Controller&quot;),
      (&quot;Operating System Service Pack&quot;, []),
      (&quot;Operating System Hotfixes:&quot;,
       &quot;Update for Microsoft Windows (KB4049065)&quot;,
       &quot;Update for Microsoft Windows (KB4486129)&quot;),
      (&quot;Dell PC:&quot;, &quot;Yes&quot;)
  )
  </code></pre>
  <p>Through iteration, my program's current output looks like this:</p>
  <pre class="lang-none prettyprint-override"><code>Type:
  Security Server
  Type:
  Primary Domain Controller
  Operating System Service Pack:
  Operating System Hotfixes:
  Update for Microsoft Windows (KB4049065)
  Update for Microsoft Windows (KB4486129)
  Security Update for Microsoft Windows (KB4503537)
  Dell PC:
  Yes
  </code></pre>
  <p>The elements of the tuple therefore need to be broken on the last line before the next line that ends in a <code>:</code>. Additionally, note that &quot;Operating System Service Pack&quot; had no entry after it.</p>
  <p>I'll be using this tuple to populate a dictionary, however if there is a Pythonic way of popping my iterated output directly to a dictionary then this would be preferred over the tuple.</p>
  <p>Here is an approximation of what this would look like in a dataframe:</p>
  <p><a href="https://i.stack.imgur.com/Dpe9r.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Dpe9r.png" alt="" /></a></p>
  <p>I have pulled this data from an HTML document using Beautiful soup, parsing the tables and stripping whitespace.  Here is a small snippet. I will need to grab only the pertinent information and get it into a dictionary. Here is a small sample.</p>
  <pre class="lang-html prettyprint-override"><code>&lt;td class=&quot;ParamColumn&quot;&gt;
                              Type:
                            &lt;/td&gt;
  &lt;td class=&quot;ValueColumn&quot;&gt;Security Server&lt;/td&gt;
  &lt;td class=&quot;ParamColumn&quot;&gt;
                              Type:
                            &lt;/td&gt;
  &lt;td class=&quot;ValueColumn&quot;&gt;Primary Domain Controller&lt;/td&gt;
  &lt;td class=&quot;ParamColumn&quot;&gt;
                              Software Revision:
                            &lt;/td&gt;
  &lt;td class=&quot;ValueColumn&quot;&gt;3.8.0&lt;/td&gt;
  &lt;td class=&quot;ParamColumn&quot;&gt;
                              Operating System Name:
                            &lt;/td&gt;
  &lt;td class=&quot;ValueColumn&quot;&gt;Microsoft Windows Server 2016 Standard (64-bit)&lt;/td&gt;
  &lt;td class=&quot;ParamColumn&quot;&gt;
                              Operating System Build:
                            &lt;/td&gt;
  &lt;td class=&quot;ValueColumn&quot;&gt;10.0.14393&lt;/td&gt;
  &lt;td class=&quot;ParamColumn&quot;&gt;
                              Operating System Service Pack:
                            &lt;/td&gt;
  </code></pre>