writing tab seperated values into a file
<p>From a file, i have taken a line, split the line into 5 columns using <code>split()</code>. But i have to write those columns as tab seperated values in an output file. </p>

<p>Lets say that i have <code>l[1], l[2], l[3], l[4], l[5]</code>...a total of 5 entries. How can i achieve this using python? And also, i am not able to write <code>l[1], l[2], l[3], l[4], l[5]</code> values to an output file. </p>

<p>I tried both these codes, both not working(i am using python 2.6):</p>

<p>code 1:</p>

<pre><code>with open('output', 'w'):
   print l[1], l[2], l[3], l[4], l[5] &gt; output
</code></pre>

<p>code 2:</p>

<pre><code>with open('output', 'w') as outf:
   outf.write(l[1], l[2], l[3], l[4], l[5])
</code></pre>
