<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Export to CSV with Override and NO Header Row - Python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/export-to-csv-with-override-and-no-header-row/m-p/449841#M35226</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This issue is much simpler to solve, and I would argue more robust, by addressing it on the import side rather than export side.&amp;nbsp; It is so much easier to simply skip a line at the start of a file when reading it than removing the first line after it is created.&amp;nbsp; Once the file is created, most or all techniques for removing the line involves reading and re-writing the file.&amp;nbsp; One approach to not creating the header line in the first place would be to export the data set to a pandas dataframe and then export to csv from there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can the import process be modified to inspect the first line and then decide whether to skip it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Jun 2020 15:09:47 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2020-06-25T15:09:47Z</dc:date>
    <item>
      <title>Export to CSV with Override and NO Header Row - Python</title>
      <link>https://community.esri.com/t5/python-questions/export-to-csv-with-override-and-no-header-row/m-p/449839#M35224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've built a Pythons script the organizes a dataset that is used for an external database and exported it from a File Geodatabase to a .CSV file. The last part of the workflow is to manually delete the header row and copy the CSV to a network drive and override the existing .CSV file. Now, its been requested to make the workflow 100% automatic and have it built into my current Batch File collection to run each night. Just (2) pieces of the script I cannot figure out how to write:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;1) Export File GDB Table to .CSV file WithOut the Header Row&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;2) When the .CSV file is exported, it Overrides the existing file in it's place with the same name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any assistance, would be appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2020 22:22:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-to-csv-with-override-and-no-header-row/m-p/449839#M35224</guid>
      <dc:creator>ModernElectric</dc:creator>
      <dc:date>2020-06-24T22:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: Export to CSV with Override and NO Header Row - Python</title>
      <link>https://community.esri.com/t5/python-questions/export-to-csv-with-override-and-no-header-row/m-p/449840#M35225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/8679" target="_blank"&gt;Modern Electric&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;Here's the code that exports a File GDB Table to a .CSV file WithOut the Header Row and it also overrides the existing file in it's place with the same name.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; csv&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; os

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;overwriteOutput &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;

workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"working path"&lt;/SPAN&gt;
gdb_fc   &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;workspace&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"path to GDB Feature Class"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
outfile &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;workspace&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"output_data.csv"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;      

fields &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListFields&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;gdb_fc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
field_names &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;field&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; field &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; fields&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; open&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;outfile&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'w'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; f&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    w &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; csv&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;writer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#     w.writerow(field_names) **This is commented out to skip writing a header**&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SearchCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;gdb_fc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        field_vals &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getValue&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;field&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; field &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; fields&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
        w&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;writerow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;field_vals&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;del&lt;/SPAN&gt; row&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:04:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-to-csv-with-override-and-no-header-row/m-p/449840#M35225</guid>
      <dc:creator>MehdiPira1</dc:creator>
      <dc:date>2021-12-11T20:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: Export to CSV with Override and NO Header Row - Python</title>
      <link>https://community.esri.com/t5/python-questions/export-to-csv-with-override-and-no-header-row/m-p/449841#M35226</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This issue is much simpler to solve, and I would argue more robust, by addressing it on the import side rather than export side.&amp;nbsp; It is so much easier to simply skip a line at the start of a file when reading it than removing the first line after it is created.&amp;nbsp; Once the file is created, most or all techniques for removing the line involves reading and re-writing the file.&amp;nbsp; One approach to not creating the header line in the first place would be to export the data set to a pandas dataframe and then export to csv from there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can the import process be modified to inspect the first line and then decide whether to skip it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2020 15:09:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-to-csv-with-override-and-no-header-row/m-p/449841#M35226</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-06-25T15:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: Export to CSV with Override and NO Header Row - Python</title>
      <link>https://community.esri.com/t5/python-questions/export-to-csv-with-override-and-no-header-row/m-p/449842#M35227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mehdi:&lt;/P&gt;&lt;P&gt;Thank You for the assistance. Looks like we are almost there. Here are (2) issues that I am having. I hate to be picky but if the .CSV file is not 100% correct, the database that loads it will fail the upload process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I open the .CSV in Microsoft Excel, the export adds a separate field, I assume its the ESRI automatic OID number (might be mistaken on the field name).&lt;/P&gt;&lt;P&gt;The other problem is between each line, there is a space. I know for a fact having the space between each row will force the upload process to fail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" height="136" src="https://community.esri.com/legacyfs/online/497901_pastedImage_1.png" width="557" /&gt;&lt;/P&gt;&lt;P&gt;Here is a clip of what the .CSV file looks like after opening it in Excel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any other advice on these (2) items and I should be in good shape.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2020 15:58:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-to-csv-with-override-and-no-header-row/m-p/449842#M35227</guid>
      <dc:creator>ModernElectric</dc:creator>
      <dc:date>2020-06-25T15:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: Export to CSV with Override and NO Header Row - Python</title>
      <link>https://community.esri.com/t5/python-questions/export-to-csv-with-override-and-no-header-row/m-p/449843#M35228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/8679" target="_blank"&gt;Modern Electric&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;Try this one, it removes blank rows and you can specify which fields to output in the csv file:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; csv&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; os

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;overwriteOutput &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;

workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"working path"&lt;/SPAN&gt;
gdb_fc   &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;workspace&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"path to GDB Feature Class"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
outfile &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;workspace&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"output_data.csv"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;      

fields &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListFields&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;gdb_fc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# for instance, you want to output just the following fields&lt;/SPAN&gt;
fieldsToKeep &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Tree_Type'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Latitude'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Longitude'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Tree_Height'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Note'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# field_names = [field.name for field in fields if field.name in fieldsToKeep]&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; open&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;outfile&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'w'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; newline&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;''&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; f&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    w &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; csv&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;writer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#     w.writerow(field_names) **This is commented out to skip writing a header**&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SearchCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;gdb_fc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        field_vals &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getValue&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;field&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; field &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; fields &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; field&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; fieldsToKeep&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
        w&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;writerow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;field_vals&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;del&lt;/SPAN&gt; row
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:04:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-to-csv-with-override-and-no-header-row/m-p/449843#M35228</guid>
      <dc:creator>MehdiPira1</dc:creator>
      <dc:date>2021-12-11T20:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: Export to CSV with Override and NO Header Row - Python</title>
      <link>https://community.esri.com/t5/python-questions/export-to-csv-with-override-and-no-header-row/m-p/449844#M35229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank You Mehdi:&lt;/P&gt;&lt;P&gt;Looks like we are almost there, however:&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;with open(outfile,'w', newline='') as f:&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;is giving me this:&lt;/P&gt;&lt;P&gt;TypeError: 'newline' is an invalid keyword argument for this function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure what that means.&lt;/P&gt;&lt;P&gt;If I replace this line with what you had in the original script:&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;with open(outfile,'w') as f:&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The script works, BUT still has spaces between the rows.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2020 16:36:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-to-csv-with-override-and-no-header-row/m-p/449844#M35229</guid>
      <dc:creator>ModernElectric</dc:creator>
      <dc:date>2020-06-26T16:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: Export to CSV with Override and NO Header Row - Python</title>
      <link>https://community.esri.com/t5/python-questions/export-to-csv-with-override-and-no-header-row/m-p/449845#M35230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/8679" target="_blank"&gt;Modern Electric&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;You're using Python 2.x which doesn't support '&lt;SPAN style="background-color: #ffffff;"&gt;newline'.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Remove this&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;newline=''&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;then add the following at the end of the&amp;nbsp;previous code. It should work now.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;file_object &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; open&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;outfile&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'r'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
lines &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; csv&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;reader&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;file_object&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; delimiter&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;','&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; quotechar&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'"'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
flag &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;
data&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; line &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; lines&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; line &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        flag &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;continue&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        data&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;append&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;line&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
file_object&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;close&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; flag &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;#if blank line is present in file&lt;/SPAN&gt;
    file_object &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; open&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;outfile&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'w'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; line &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; data&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        str1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;','&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;line&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        file_object&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;write&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;str1&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"\n"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    file_object&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;close&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:04:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-to-csv-with-override-and-no-header-row/m-p/449845#M35230</guid>
      <dc:creator>MehdiPira1</dc:creator>
      <dc:date>2021-12-11T20:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: Export to CSV with Override and NO Header Row - Python</title>
      <link>https://community.esri.com/t5/python-questions/export-to-csv-with-override-and-no-header-row/m-p/449846#M35231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;BINGO!!&lt;/P&gt;&lt;P&gt;Only one thing I changed in the code:&lt;/P&gt;&lt;P&gt;if flag ==0&lt;/P&gt;&lt;P&gt;This made the spaced go away. When there was a "1", it kept including the spaces.&lt;/P&gt;&lt;P&gt;Appreciate your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2020 18:11:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-to-csv-with-override-and-no-header-row/m-p/449846#M35231</guid>
      <dc:creator>ModernElectric</dc:creator>
      <dc:date>2020-06-26T18:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: Export to CSV with Override and NO Header Row - Python</title>
      <link>https://community.esri.com/t5/python-questions/export-to-csv-with-override-and-no-header-row/m-p/449847#M35232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not a problem&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/8679"&gt;Modern Electric&lt;/A&gt;‌.&lt;/P&gt;&lt;P&gt;Great to hear that&lt;/P&gt;&lt;P&gt;Could you please flag the question as Answered?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2020 18:18:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-to-csv-with-override-and-no-header-row/m-p/449847#M35232</guid>
      <dc:creator>MehdiPira1</dc:creator>
      <dc:date>2020-06-26T18:18:11Z</dc:date>
    </item>
  </channel>
</rss>

