Rebuild list with set set length
<p>I'm building a Python script to do a network inventory on our internal system. Each system has up to five clusters and I am looking for a way to adjust the list to put them all into one line per cluster. Here's the way they are stored on the system:</p>

<blockquote>
  <p>Cluster One<br>
  Primary System<br>
  Node One<br>
  x.x.x.x (Node IP)<br>
  Node two<br>
  x.x.x.x (Node IP)<br>
  Cluster Two<br>
  Primary System<br>
  Node One<br>
  x.x.x.x (Node IP)<br>
  Node two<br>
  x.x.x.x (Node IP)<br></p>
</blockquote>

<p>I need to have them adjusted to look like this:</p>

<blockquote>
  <p>Cluster One,Primary System,Node One,x.x.x.x (Node IP),Node Two,x.x.x.x (Node IP)<br>
  Cluster Two,Primary System,Node One,x.x.x.x (Node IP),Node Two,x.x.x.x (Node IP)</p>
</blockquote>

<p>Here is some REALLY sloppy code I'm using right now, but I was wondering if there is a more efficient way to do it:</p>

<pre><code>NetworkTableCount = len(NetworkTable) / 6 + 1
    count = 1
    while count &lt; NetworkTableCount:
            if count == 1:
                    Temp = (NetworkTable[0]+","+NetworkTable[1]+","+NetworkTable[2]+","+NetworkTable[3]+","+NetworkTable[4]+","+NetworkTable[5]+"\n")
            elif count == 2:
                    Temp = (NetworkTable[6]+","+NetworkTable[7]+","+NetworkTable[8]+","+NetworkTable[9]+","+NetworkTable[10]+","+NetworkTable[11]+"\n")
            elif count == 3:
                    Temp = (NetworkTable[12]+","+NetworkTable[13]+","+NetworkTable[14]+","+NetworkTable[15]+","+NetworkTable[16]+","+NetworkTable[17]+"\n")
            elif count == 4:
                    Temp = (NetworkTable[18]+","+NetworkTable[19]+","+NetworkTable[20]+","+NetworkTable[21]+","+NetworkTable[22]+","+NetworkTable[23]+"\n")
            elif count == 5:
                    Temp = (NetworkTable[24]+","+NetworkTable[25]+","+NetworkTable[26]+","+NetworkTable[27]+","+NetworkTable[28]+","+NetworkTable[29]+"\n")
            NetworkTopology.write(Temp)
            count = count + 1
</code></pre>

<p>I'm self taught in Python so it may just be a simple adjustment. Thanks in advance.</p>
