title: How to output vertical bar format in textfile
body: <p>I am trying to save my contents in the textfile in this format</p>
  
  <pre><code>|Name|Description|
  
  |QY|Hello|
  </code></pre>
  
  <p>But for now mine is returning me as this output:</p>
  
  <pre><code>|2014 1Q    2014 2Q 2014 3Q 2014 4Q|
  
  |96,368.3   96,808.3    97,382  99,530.5|
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>def write_to_txt(header,data):
      with open('test.txt','a+') as f:
          f.write("|{}|\n".format('\t'.join(str(field) 
                            for field in header))) # write header 
          f.write("|{}|\n".format('\t'.join(str(field) 
                            for field in data))) # write items
  </code></pre>
  
  <p>Any idea how to change my code so that I would have the ideal output?</p>