Hello all,<br><br>  I have a csv file (from a previous code output). It looks like this:<br>Species2, Protein ID, E_value, Length, Hit From, Hit to, Protein ID2, Locus Tag, Start/Stop, Species<br>Streptomyces sp. AA4,  ZP_05482482,  2.8293600000000001e-140,  5256,  1824,  2249\n, ZP_05482482,  StAA4_0101000304844,  complement(NZ_ACEV01000078.1:25146..40916)4,  Streptomyces sp. AA4: 0\n<br>
Streptomyces sp. AA4,  ZP_05482482,  8.0333299999999997e-138,  5256,  123,  547\n, ZP_05482482,  StAA4_0101000304844,  complement(NZ_ACEV01000078.1:25146..40916)4,  Streptomyces sp. AA4: 0\n<br>Streptomyces sp. AA4,  ZP_05482482,  1.08889e-124,  5256,  3539,  3956\n, ZP_05482482,  StAA4_0101000304844,  complement(NZ_ACEV01000078.1:25146..40916)4,  Streptomyces sp. AA4: 0\n<br>
....<br><br>I want to removing certain sections in each line so I wrote this code using csv.DictWriter:<br>import csv<br>data = csv.DictReader(open(&#39;strep_aa.txt&#39;))<br><br>for x in data:<br>    del x[&#39;Species2&#39;]<br>
    del x[&#39; Protein ID2&#39;]<br>    print x<br><br>  When it prints to the screen everything works great:<br>{&#39; Hit From&#39;: &#39;  1824&#39;, &#39; Hit to&#39;: &#39;  2249\\n&#39;, &#39; Protein ID&#39;: &#39;  ZP_05482482&#39;, &#39; Locus Tag&#39;: &#39;  StAA4_0101000304844&#39;, &#39; Start/Stop&#39;: &#39;  complement(NZ_ACEV01000078.1:25146..40916)4&#39;, &#39; Species&#39;: &#39;  Streptomyces sp. AA4: 0\\n&#39;, &#39; Length&#39;: &#39;  5256&#39;, &#39; E_value&#39;: &#39;  2.8293600000000001e-140&#39;}<br>
{&#39; Hit From&#39;: &#39;  123&#39;, &#39; Hit to&#39;: &#39;  547\\n&#39;, &#39; Protein ID&#39;: &#39;  ZP_05482482&#39;, &#39; Locus Tag&#39;: &#39;  StAA4_0101000304844&#39;, &#39; Start/Stop&#39;: &#39;  complement(NZ_ACEV01000078.1:25146..40916)4&#39;, &#39; Species&#39;: &#39;  Streptomyces sp. AA4: 0\\n&#39;, &#39; Length&#39;: &#39;  5256&#39;, &#39; E_value&#39;: &#39;  8.0333299999999997e-138&#39;}<br>
<br clear="all">What I don&#39;t know how to do is the export this back out a csv file and rearrange each key as a column header so it work look like this:<br>Species  Protein ID  E Value  .....<br><br>I thought csv.DictWriter would be the way to go since it writes dictionaries to text files. I was wondering how do I go about doing this? I don&#39;t really understand the syntax.<br>
<br>Thank you!<br><br>Ara<br><br><br>-- <br>Quis hic locus, quae regio, quae mundi plaga. Ubi sum. Sub ortu solis an sub cardine glacialis ursae.<br>