title: Python: Write dictionary lists with different indexes to CSV file
body: <p>I have a dictionary of lists in which some lists only have one value while the others have many.</p>
  
  <p>Using this code, I get the output I intend:</p>
  
  <pre><code>    import csv
      from collections import OrderedDict
  
      my_dict = OrderedDict()
      my_dict["Header1"] = [1,2,3]
      my_dict["Header2"] = [4,5,6]
  
      #if file doesn't exist...
      with open('mycsv.csv', 'wb') as f:
          w = csv.writer(f, delimiter=';')
          w.writerow(my_dict.keys())
      with open('mycsv.csv', 'ab') as f:
          w = csv.writer(f, delimiter=';')
          w.writerows(zip(*my_dict.values()))
  </code></pre>
  
  <p>Which will look somewhat like:</p>
  
  <p>Header1;Header2</p>
  
  <p>1;4</p>
  
  <p>2;5</p>
  
  <p>3;6</p>
  
  <p>But in my case, when I have a dictionary of lists of this sort:</p>
  
  <pre><code>    my_dict["Header1"] = [1,2,3]
      my_dict["Header2"] = [4]
  </code></pre>
  
  <p>I get an output like:</p>
  
  <p>Header1;Header2</p>
  
  <p>1;4</p>
  
  <p>When I intended to have:</p>
  
  <p>Header1;Header2</p>
  
  <p>1;4</p>
  
  <p>2;</p>
  
  <p>3;</p>
  
  <p>Any suggestions on how to solve this?</p>
  
  <p>Thank you in advance (and sorry for any bad thread formatting,it's my first question here :P)!</p>