<?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: Text to GIS dbase Best Practices in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64604#M5301</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; r+ is for appending, how does rb work?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i tried rb, nothing happens. I tried r+b, same. I tried w, which does work, but not what I need. If r+ is for appending then python needs to update there doc. I also tried a.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://docs.python.org/tutorial/inputoutput.html" rel="nofollow"&gt;http://docs.python.org/tutorial/inputoutput.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;7.2. Reading and Writing Files&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;open() returns a file object, and is most commonly used with two arguments: open(filename, mode).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; f = open('/tmp/workfile', 'w')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; print f&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;open file '/tmp/workfile', mode 'w' at 80a0960&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size:&amp;quot;2&amp;quot;;"&gt;The first argument is a string containing the filename. The second argument is another string containing a few characters describing the way in which the file will be used. mode can be 'r' when the file will only be read, 'w' for only writing (an existing file with the same name will be erased), and 'a' opens the file for appending; any data written to the file is automatically added to the end.&lt;STRONG&gt; 'r+' opens the file for both reading and writing&lt;/STRONG&gt;. The mode argument is optional; 'r' will be assumed if itâ??s omitted.&lt;BR /&gt;&lt;BR /&gt;On Windows, 'b' appended to the mode opens the file in binary mode, so there are also modes like 'rb', 'wb', and 'r+b'. Python on Windows makes a distinction between text and binary files; the end-of-line characters in text files are automatically altered slightly when data is read or written. This behind-the-scenes modification to file data is fine for ASCII text files, but itâ??ll corrupt binary data like that in JPEG or EXE files. Be very careful to use binary mode when reading and writing such files. On Unix, it doesnâ??t hurt to append a 'b' to the mode, so you can use it platform-independently for all binary files.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Sep 2011 14:58:51 GMT</pubDate>
    <dc:creator>TedCronin</dc:creator>
    <dc:date>2011-09-01T14:58:51Z</dc:date>
    <item>
      <title>Text to GIS dbase Best Practices</title>
      <link>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64597#M5294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This may seem trivial to some, but what is the best way to go for conversion purposes, from a text file into a GIS format.&amp;nbsp; I was looking to use win32com and convert a txt file right into Access, but Esri does not support the .accdb format, so this does not solve my issue, unless win32com allows to go straight into a mdb.&amp;nbsp; I was also thinking of the dbf format (Seems like a dated approach), or does it make sense to just use the insertcursor from a text file right into a file GB.&amp;nbsp; I get a lot of txt files from management, and I am looking to just build a tool for myself or them to get something a bit more useful and streamline my own workflow.&amp;nbsp; i don't really want to go into SQL Server or Postgress for simple operations.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Aug 2011 22:42:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64597#M5294</guid>
      <dc:creator>TedCronin</dc:creator>
      <dc:date>2011-08-30T22:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Text to GIS dbase Best Practices</title>
      <link>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64598#M5295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This may seem trivial to some, but what is the best way to go for conversion purposes, from a text file into a GIS format.&amp;nbsp; I was looking to use win32com and convert a txt file right into Access, but Esri does not support the .accdb format, so this does not solve my issue, unless win32com allows to go straight into a mdb.&amp;nbsp; I was also thinking of the dbf format (Seems like a dated approach), or does it make sense to just use the insertcursor from a text file right into a file GB.&amp;nbsp; I get a lot of txt files from management, and I am looking to just build a tool for myself or them to get something a bit more useful and streamline my own workflow.&amp;nbsp; i don't really want to go into SQL Server or Postgress for simple operations.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Ted &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Could depend on how your .txt files are structured, but a .txt can be read by most tools that accept a table or table view as input.&amp;nbsp; So you could feed it directly into tools like Make XY Event Layer or XY To Line.&amp;nbsp; Or you could read in the file in Python and write out in your own flavor with a cursor.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Dave&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Aug 2011 22:59:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64598#M5295</guid>
      <dc:creator>DavidWynne</dc:creator>
      <dc:date>2011-08-30T22:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: Text to GIS dbase Best Practices</title>
      <link>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64599#M5296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi Ted &lt;BR /&gt;Could depend on how your .txt files are structured, but a .txt can be read by most tools that accept a table or table view as input.&amp;nbsp; So you could feed it directly into tools like Make XY Event Layer or XY To Line.&amp;nbsp; Or you could read in the file in Python and write out in your own flavor with a cursor.&lt;BR /&gt;&lt;BR /&gt;-Dave&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That was fast, so txt file can be read as a table, thats interesting, something to explore for sure.&amp;nbsp; thanks David.&amp;nbsp; I like the last idea at least for testing purposes at 10.1.&amp;nbsp; So, regarding the structure, do the tools, handle comma delimited, and treat the top row as the column headings?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Aug 2011 23:03:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64599#M5296</guid>
      <dc:creator>TedCronin</dc:creator>
      <dc:date>2011-08-30T23:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: Text to GIS dbase Best Practices</title>
      <link>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64600#M5297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;That was fast, so txt file can be read as a table, thats interesting, something to explore for sure.&amp;nbsp; thanks David.&amp;nbsp; I like the last idea at least for testing purposes at 10.1.&amp;nbsp; So, regarding the structure, do the tools, handle comma delimited, and treat the top row as the column headings?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just to confirm myself, I created a little text file that contained this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;a,b,c,d&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1,2,3,S&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4,5,6,T&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I used that as input to TableToTable and it spit out a table of 2 rows with 5 fields (OBJECTID, a, b, c, d)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Dave&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Aug 2011 23:11:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64600#M5297</guid>
      <dc:creator>DavidWynne</dc:creator>
      <dc:date>2011-08-30T23:11:33Z</dc:date>
    </item>
    <item>
      <title>Re: Text to GIS dbase Best Practices</title>
      <link>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64601#M5298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Yes.&lt;BR /&gt;&lt;BR /&gt;Just to confirm myself, I created a little text file that contained this:&lt;BR /&gt;a,b,c,d&lt;BR /&gt;1,2,3,S&lt;BR /&gt;4,5,6,T&lt;BR /&gt;&lt;BR /&gt;I used that as input to TableToTable and it spit out a table of 2 rows with 5 fields (OBJECTID, a, b, c, d)&lt;BR /&gt;&lt;BR /&gt;-Dave&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am actually playing with that now, which is pretty cool, I would just need to write a read to check the first line for bad field names, and then do&amp;nbsp; str.replace, like ("/", "_") or (" ", "_").&amp;nbsp; Cool, this is MUCH easier than what I was planning on doing.&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG&gt;Thank you&lt;/STRONG&gt;&lt;SPAN&gt; David, for helping me with the MUCH easier route.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;WOW.&amp;nbsp; Is this new, or was this always here?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Damn, cool, way to go...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Aug 2011 23:14:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64601#M5298</guid>
      <dc:creator>TedCronin</dc:creator>
      <dc:date>2011-08-30T23:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Text to GIS dbase Best Practices</title>
      <link>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64602#M5299</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So, not to pick a brain or two, but are there any issues with 2.7 with reading/write a txt file and making a change and thinking it would change.&amp;nbsp; i am trying with "r+", within an open ("....txt", "r+), and the txt file does not seem to be saving.&amp;nbsp; My replace i think is sound, it prints on screen what I would expect, but nothing changes in the txt file?&amp;nbsp; hoping for 2 for 2 &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;with open (r"C:\1GIS\Sales\ReplaceString\Sales2011.txt", "r+") as txtFile:
&amp;nbsp;&amp;nbsp;&amp;nbsp; data = txtFile.readline()
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "*" * 530
&amp;nbsp;&amp;nbsp;&amp;nbsp; print data
&amp;nbsp;&amp;nbsp;&amp;nbsp; change = data.replace("/ ", "_").replace("/", "_").replace(" ", "_")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print change&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;playing with with statements, but I have the same code w/o with&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:29:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64602#M5299</guid>
      <dc:creator>TedCronin</dc:creator>
      <dc:date>2021-12-10T22:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: Text to GIS dbase Best Practices</title>
      <link>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64603#M5300</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;r+ is for appending, how does rb work?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Aug 2011 22:58:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64603#M5300</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2011-08-31T22:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Text to GIS dbase Best Practices</title>
      <link>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64604#M5301</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; r+ is for appending, how does rb work?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i tried rb, nothing happens. I tried r+b, same. I tried w, which does work, but not what I need. If r+ is for appending then python needs to update there doc. I also tried a.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://docs.python.org/tutorial/inputoutput.html" rel="nofollow"&gt;http://docs.python.org/tutorial/inputoutput.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;7.2. Reading and Writing Files&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;open() returns a file object, and is most commonly used with two arguments: open(filename, mode).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; f = open('/tmp/workfile', 'w')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; print f&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;open file '/tmp/workfile', mode 'w' at 80a0960&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size:&amp;quot;2&amp;quot;;"&gt;The first argument is a string containing the filename. The second argument is another string containing a few characters describing the way in which the file will be used. mode can be 'r' when the file will only be read, 'w' for only writing (an existing file with the same name will be erased), and 'a' opens the file for appending; any data written to the file is automatically added to the end.&lt;STRONG&gt; 'r+' opens the file for both reading and writing&lt;/STRONG&gt;. The mode argument is optional; 'r' will be assumed if itâ??s omitted.&lt;BR /&gt;&lt;BR /&gt;On Windows, 'b' appended to the mode opens the file in binary mode, so there are also modes like 'rb', 'wb', and 'r+b'. Python on Windows makes a distinction between text and binary files; the end-of-line characters in text files are automatically altered slightly when data is read or written. This behind-the-scenes modification to file data is fine for ASCII text files, but itâ??ll corrupt binary data like that in JPEG or EXE files. Be very careful to use binary mode when reading and writing such files. On Unix, it doesnâ??t hurt to append a 'b' to the mode, so you can use it platform-independently for all binary files.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Sep 2011 14:58:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64604#M5301</guid>
      <dc:creator>TedCronin</dc:creator>
      <dc:date>2011-09-01T14:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: Text to GIS dbase Best Practices</title>
      <link>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64605#M5302</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ohhhh, you're not actually doing the .write() call, you're just reading. You may want to read from the file and output to a new one to be safe.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Sep 2011 16:00:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64605#M5302</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2011-09-01T16:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: Text to GIS dbase Best Practices</title>
      <link>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64606#M5303</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Ohhhh, you're not actually doing the .write() call, you're just reading. You may want to read from the file and output to a new one to be safe.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I actually have tried both:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;txtFile.write (change)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#txtFile.writelines(change)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;inside the with statement&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The file is not getting updated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So basically, I am doing:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;with open (r"C:\1GIS\Sales\ReplaceString\Sales2011.txt", "r+b") as txtFile:
&amp;nbsp;&amp;nbsp;&amp;nbsp; data = txtFile.readline()
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "*" * 530
&amp;nbsp;&amp;nbsp;&amp;nbsp; print data
&amp;nbsp;&amp;nbsp;&amp;nbsp; change = data.replace("/ ", "_").replace("/", "_").replace(" ", "_")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print change
&amp;nbsp;&amp;nbsp;&amp;nbsp; txtFile.write (change)
&amp;nbsp;&amp;nbsp;&amp;nbsp; #txtFile.writelines(change)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:29:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64606#M5303</guid>
      <dc:creator>TedCronin</dc:creator>
      <dc:date>2021-12-10T22:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: Text to GIS dbase Best Practices</title>
      <link>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64607#M5304</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I actually have tried both:&lt;BR /&gt;txtFile.write (change)&lt;BR /&gt;#txtFile.writelines(change)&lt;BR /&gt;&lt;BR /&gt;inside the with statement&lt;BR /&gt;&lt;BR /&gt;The file is not getting updated.&lt;BR /&gt;&lt;BR /&gt;So basically, I am doing:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;with open (r"C:\1GIS\Sales\ReplaceString\Sales2011.txt", "r+b") as txtFile:
&amp;nbsp;&amp;nbsp;&amp;nbsp; data = txtFile.readline()
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "*" * 530
&amp;nbsp;&amp;nbsp;&amp;nbsp; print data
&amp;nbsp;&amp;nbsp;&amp;nbsp; change = data.replace("/ ", "_").replace("/", "_").replace(" ", "_")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print change
&amp;nbsp;&amp;nbsp;&amp;nbsp; txtFile.write (change)
&amp;nbsp;&amp;nbsp;&amp;nbsp; #txtFile.writelines(change)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Ted, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I haven't used the r+b flag, i shall give that one a whirl at some point. I have always read original.txt and write to new.txt followed by using os.remove() cleanup if there are intermediate steps ot text file i do not want to hang onto.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but i have smooshed a bit of text into csv. And i have always just passed the replaces back to the variable. e.g.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;data = txtFile.readline()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while data:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; data = data.replace("/ ", "_").replace("/", "_").replace(" ", "_")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFile.write(data)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; data = txtFile.readline()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i think it might be the r+ flag might be the sticking point. i should go read the notes on it.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:29:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64607#M5304</guid>
      <dc:creator>StevenCyphers</dc:creator>
      <dc:date>2021-12-10T22:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: Text to GIS dbase Best Practices</title>
      <link>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64608#M5305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi Ted, &lt;BR /&gt;&lt;BR /&gt;I haven't used the r+b flag, i shall give that one a whirl at some point. I have always read original.txt and write to new.txt followed by using os.remove() cleanup if there are intermediate steps ot text file i do not want to hang onto.&lt;BR /&gt;&lt;BR /&gt;but i have smooshed a bit of text into csv. And i have always just passed the replaces back to the variable. e.g.&lt;BR /&gt;&lt;BR /&gt;data = txtFile.readline()&lt;BR /&gt;while data:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; data = data.replace("/ ", "_").replace("/", "_").replace(" ", "_")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFile.write(data)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; data = txtFile.readline()&lt;BR /&gt;&lt;BR /&gt;i think it might be the r+ flag might be the sticking point. i should go read the notes on it.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will have to play with this a bit more, so cool, thanks for giving me an idea.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Dec 2011 23:57:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/text-to-gis-dbase-best-practices/m-p/64608#M5305</guid>
      <dc:creator>TedCronin</dc:creator>
      <dc:date>2011-12-01T23:57:07Z</dc:date>
    </item>
  </channel>
</rss>

