<?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: Writing out comma separated values in a single cell in spreadsheet in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189958#M14580</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ah...I misunderstood.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, how do you determine what is a word?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Codewise, "catdogmouse" is a word.&amp;nbsp; I'm not aware of any methods you could implement that would just pick out "cat", "dog" or "mouse" from a string.&amp;nbsp; We do that as humans but programmatically I would think you'd need a library/dictionary of possible words that had those three included to test each value.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Apr 2015 20:01:15 GMT</pubDate>
    <dc:creator>JamesCrandall</dc:creator>
    <dc:date>2015-04-24T20:01:15Z</dc:date>
    <item>
      <title>Writing out comma separated values in a single cell in spreadsheet</title>
      <link>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189951#M14573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please excuse the long subject header. I have gotten pretty good at writing data out to csv files but i seem to have stumbled into this block. Anytime a ',' (comma) is used to join values, it shifts over to the next cell in the spreadsheet. What I want to accomplished is for example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Inside a single cell, write out cat,dog,mouse&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Already checked the csv module in python docs and nothing immediately jumped out at me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2015 17:56:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189951#M14573</guid>
      <dc:creator>benberman</dc:creator>
      <dc:date>2015-04-24T17:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: Writing out comma separated values in a single cell in spreadsheet</title>
      <link>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189952#M14574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;...,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Wrap the string in quotes if it has a comma in the value.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2015 18:01:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189952#M14574</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2015-04-24T18:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Writing out comma separated values in a single cell in spreadsheet</title>
      <link>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189953#M14575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could make the output tab delimited instead of comma delimited - ('\t' in python).&amp;nbsp; Or maybe enclose that whole string in quotes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2015 18:03:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189953#M14575</guid>
      <dc:creator>JeffWard</dc:creator>
      <dc:date>2015-04-24T18:03:26Z</dc:date>
    </item>
    <item>
      <title>Re: Writing out comma separated values in a single cell in spreadsheet</title>
      <link>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189954#M14576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're faster at the typing Robert. &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2015 18:16:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189954#M14576</guid>
      <dc:creator>JeffWard</dc:creator>
      <dc:date>2015-04-24T18:16:09Z</dc:date>
    </item>
    <item>
      <title>Re: Writing out comma separated values in a single cell in spreadsheet</title>
      <link>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189955#M14577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it's data derived internal to your organization, then I would suggest that you need to address the way that data is getting generated, apply some business rules to that process so that you don't run into issues just like this later on down the road.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2015 18:58:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189955#M14577</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2015-04-24T18:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Writing out comma separated values in a single cell in spreadsheet</title>
      <link>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189956#M14578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The string will not have commas in it. I am trying to insert commas into the string to separate out the values, without shifting the values into consecutive cells. So, the string will be something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g. catdogmouse&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to insert a comma between each word within the same cell. Make sense?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2015 19:35:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189956#M14578</guid>
      <dc:creator>benberman</dc:creator>
      <dc:date>2015-04-24T19:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: Writing out comma separated values in a single cell in spreadsheet</title>
      <link>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189957#M14579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Enclosing in double quotes doesn't work? output = '"cat,dog,mouse"' or single quote double quote cat,dog,mouse double quote single quote.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you using python to parse?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2015 19:56:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189957#M14579</guid>
      <dc:creator>JeffWard</dc:creator>
      <dc:date>2015-04-24T19:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Writing out comma separated values in a single cell in spreadsheet</title>
      <link>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189958#M14580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ah...I misunderstood.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, how do you determine what is a word?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Codewise, "catdogmouse" is a word.&amp;nbsp; I'm not aware of any methods you could implement that would just pick out "cat", "dog" or "mouse" from a string.&amp;nbsp; We do that as humans but programmatically I would think you'd need a library/dictionary of possible words that had those three included to test each value.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2015 20:01:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189958#M14580</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2015-04-24T20:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: Writing out comma separated values in a single cell in spreadsheet</title>
      <link>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189959#M14581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;grief...read Robert's initial post&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; import string
&amp;gt;&amp;gt;&amp;gt; a = ' "cat, mouse, dog" '&amp;nbsp; # a double-quoted string, surrounded with single quotes...or equivalent
&amp;gt;&amp;gt;&amp;gt; b = string.split(a,",")
&amp;gt;&amp;gt;&amp;gt; b&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # yields a list with a single entry
[' "cat', ' mouse', ' dog" ']
&amp;gt;&amp;gt;&amp;gt; c = "cat, mouse, dog"
&amp;gt;&amp;gt;&amp;gt; d = string.split(c,",")&amp;nbsp;&amp;nbsp;&amp;nbsp; # yields a list with 3 entries
&amp;gt;&amp;gt;&amp;gt; d
['cat', ' mouse', ' dog']&lt;/PRE&gt;&lt;P&gt;​&lt;/P&gt;&lt;P&gt;Examine the csv module, it handles these cases quite well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:33:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189959#M14581</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T09:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: Writing out comma separated values in a single cell in spreadsheet</title>
      <link>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189960#M14582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I see the OP's question differently...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;e.g. "catdogmouse"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to insert a comma between each word within the same cell. Make sense?&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, how are we supposed to know what is "a word" within the string?&amp;nbsp; I mean, sure it's easy to add in a "," between words, but you will have to have a dictionary of words to find within the string "catdogmouse".&amp;nbsp; To the computer "catdogmouse" is a word.&amp;nbsp; The computer doesn't know "dog" is a word and you will need some way to tell it what those words are. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2015 20:30:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189960#M14582</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2015-04-24T20:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: Writing out comma separated values in a single cell in spreadsheet</title>
      <link>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189961#M14583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For example,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;theList = ["catdog", "redbaloon", "greenorangeblue"]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, we know cat, dog, red, balloon, green, orange, and blue are all words but without instructing the program what these are, we cannot create what the OP wants:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;theDesiredList = ["cat, dog", "red, ballon", "green, orange, blue"]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2015 20:38:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189961#M14583</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2015-04-24T20:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: Writing out comma separated values in a single cell in spreadsheet</title>
      <link>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189962#M14584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;​I read that as he has distinctly different words that he want to concatenate with commas in a cell so that the csv reader&amp;nbsp; or spreadsheet will not parse it into 3 separate records/cells.&amp;nbsp; The best way of doing that is to construct the string and enclose it in quotes.&amp;nbsp; Within a spreadsheet you simply enter the words separated with commas and specify/know the string delimiter.&amp;nbsp; Using pure python or better still the csv module (reader) you can specify the delimiter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you are over reading what is available...If the OP has jumbled&amp;nbsp; ....&amp;nbsp;&amp;nbsp; catmousedog ... all unseparated into one cell, or as a python string, then the OP has bigger issues that we can address on this site &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;again ... perhaps some clarity can be given by the OP as to the specific nature of the data that is at hand because imsoconfusedrightnowanyfurtheradvisewouldbeconjecture&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT .... Answer....&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; e
'imsoconfusedrightnowanyfurtheradvisewouldbeconjecture'
&amp;gt;&amp;gt;&amp;gt; e
'imsoconfusedrightnowanyfurtheradvisewouldbeconjecture'
&amp;gt;&amp;gt;&amp;gt; idx = [0,2,4,12,17,20,23,30,36,41,43,len(e)]
&amp;gt;&amp;gt;&amp;gt; idx
[0, 2, 4, 12, 17, 20, 23, 30, 36, 41, 43, 53]
&amp;gt;&amp;gt;&amp;gt; g = [e[idx[i-1]:idx&lt;I&gt;] for i in range(1,len(idx))]&lt;/I&gt;
&amp;gt;&amp;gt;&amp;gt; g
['im', 'so', 'confused', 'right', 'now', 'any', 'further', 'advise', 'would', 'be', 'conjecture']&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:33:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189962#M14584</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T09:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: Writing out comma separated values in a single cell in spreadsheet</title>
      <link>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189963#M14585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;I read that as he has distinctly different words that he want to concatenate with commas in a cell so that the csv reader&amp;nbsp; or spreadsheet will not parse it into 3 separate records/cells.&amp;nbsp; &lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's what I thought too but then I read the OP's reply:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;e.g. "catdogmouse"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to insert a comma between each word within the same cell. Make sense?&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, yeah like you said...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt; the OP has bigger issues that we can address on this site &lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2015 20:47:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189963#M14585</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2015-04-24T20:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Writing out comma separated values in a single cell in spreadsheet</title>
      <link>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189964#M14586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;then he would be dealing with this scenario.&amp;nbsp; In this simple example, you just parse vby fixed slices, however, you can provide the slice intervals if they are different but consistent between rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perhaps that is why he goes by the name&lt;STRONG&gt; ...​&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;​&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; a = string.letters
&amp;gt;&amp;gt;&amp;gt; a
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
&amp;gt;&amp;gt;&amp;gt; b = [a&lt;I&gt; for i in range(0,len(a),3)]&lt;/I&gt;
&amp;gt;&amp;gt;&amp;gt; b
['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yzA', 'BCD', 'EFG', 'HIJ', 'KLM', 'NOP', 'QRS', 'TUV', 'WXY', 'Z']&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;back to you ... &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:33:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189964#M14586</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T09:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: Writing out comma separated values in a single cell in spreadsheet</title>
      <link>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189965#M14587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Attempting to belittle people will not be tolerated, per forum rules. I will report anyone that keeps this up. This is a professional forum. Let's keep it that way.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For those who are trying to be helpful:&lt;/P&gt;&lt;P&gt;Perhaps let me enlighten in the greater scheme of the project.&lt;/P&gt;&lt;P&gt;I am cataloging attribute fields for each feature class in the input list, below, and then I am writing the output to a spreadsheet for the occurance of the attribute in one or more of the feature classes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Column A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Column B&lt;/P&gt;&lt;P&gt;Attribute B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fc1,fc2&lt;/P&gt;&lt;P&gt;Attribute X&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fc2&lt;/P&gt;&lt;P&gt;Attribute C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fc2,fc3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the code I have so far:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;input=[fc1,fc2,fc3]&lt;/P&gt;&lt;P&gt;for fc in input:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Create dictionary of attributes and feature classes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cmp={}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lstflds=arcpy.ListFields(fc)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for fld in lstflds:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cmp.update({fld.name:fc)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for keys,values in cmp.iteritems():&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # I need to test where identical attributes exist(keys) and somehow index which feature classes(values) then catalog them in the format, above&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2015 21:49:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189965#M14587</guid>
      <dc:creator>benberman</dc:creator>
      <dc:date>2015-04-24T21:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: Writing out comma separated values in a single cell in spreadsheet</title>
      <link>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189966#M14588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I approved all comments, there was no belittlement perceived or intended.&lt;/P&gt;&lt;P&gt;And in your other post... on GIS StackExchange....&lt;/P&gt;&lt;P&gt;&lt;A href="http://gis.stackexchange.com/questions/143962/writing-out-comma-separated-values-inside-a-single-cell-in-a-spreadsheet-using-p" title="http://gis.stackexchange.com/questions/143962/writing-out-comma-separated-values-inside-a-single-cell-in-a-spreadsheet-using-p" rel="nofollow noopener noreferrer" target="_blank"&gt;Writing out comma separated values inside a single cell in a spreadsheet using python - Geographic Information Systems S…&lt;/A&gt;&lt;/P&gt;&lt;P&gt;by CoCo,...&amp;nbsp; similar advice to use the csv module or to follow Robert's initial suggestion to encapsulate in quotes to prevent separation by commas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In any event, your input fields are useful, however, the contents are what is in question​ because as I read it, your format and/or construction is in question.&amp;nbsp; Can we assume that Attribute B is some concatenation of values and you have a dictionary or some other structure containing one or more parts.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Consider the dictionary construct below.&amp;nbsp;&amp;nbsp; Which of the two string formats do you have or want?&amp;nbsp; The first, s, will be split into separate cells when imported into a spreadsheet.&amp;nbsp; The second, s1, will not since it is encased in quotes.&amp;nbsp; As you can see from the construct within the join, a comma is used in both cases (...but could be substituted with a space....but not nothing).&amp;nbsp; The construct for s1 requires an extra concatenation should you choose not to use the csv module.&amp;nbsp; The syntax is ' " ' (single, double, single) on one side of either string portion being added.&amp;nbsp; In the 'day' there used to be a string.quote() method (in Avenue) that handled than.&amp;nbsp; You could roll out a def on your own if you have need to do this all the time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; x = dict(k=['cat','mouse','dog'])
&amp;gt;&amp;gt;&amp;gt; x
{'k': ['cat', 'mouse', 'dog']}
&amp;gt;&amp;gt;&amp;gt; val = x['k']
&amp;gt;&amp;gt;&amp;gt; val
['cat', 'mouse', 'dog']
&amp;gt;&amp;gt;&amp;gt; s = ",".join(v for v in val)
&amp;gt;&amp;gt;&amp;gt; s
'cat,mouse,dog'
&amp;gt;&amp;gt;&amp;gt; s1 = '"'+s+'"'
&amp;gt;&amp;gt;&amp;gt; s1
'"cat,mouse,dog"'
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:34:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189966#M14588</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T09:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: Writing out comma separated values in a single cell in spreadsheet</title>
      <link>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189967#M14589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This the solution to the project. I'm posting it for anyone that may benefit from it. Basically, the csv module needs to be used in this instance in order to pass the object as string of comma-separated values within the same cell (see line 22). Otherwise, the values will shift over into the next cell.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN class="kwd"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; arcpy&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;collections&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;re&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;csv
arcpy&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;env&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;overwriteOutput &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;True&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
input &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;[#&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; list of feature classes&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;]&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
outfile&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="com"&gt;# path to output csv file&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
f&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;open&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;outfile&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="str"&gt;'wb'&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
csv_write&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;csv&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;writer&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;f&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
csv_write&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;writerow&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;([&lt;/SPAN&gt;&lt;SPAN class="str"&gt;'Field'&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="str"&gt;'Feature Class'&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;])&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
csv_write&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;writerow&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="str"&gt;''&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
mydict &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; collections&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;defaultdict&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;list&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
&lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;for&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; fc &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;in&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; input&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cmp&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=[]&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; lstflds&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ"&gt;ListFields&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;fc&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;for&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; fld &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;in&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; lstflds&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cmp&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;append&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;fld&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;name&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;for&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; item &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;in&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; cmp&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mydict&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;[&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;item&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;].&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;append&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;fc&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
&lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;for&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; keys&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; vals &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;in&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; mydict&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;items&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;():&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="com"&gt;# remove these characters&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; char_removal &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;[&lt;/SPAN&gt;&lt;SPAN class="str"&gt;"["&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="str"&gt;"'"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="str"&gt;"]"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;]&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; new_char &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;'['&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;+&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; re&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;escape&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="str"&gt;''&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;join&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;char_removal&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;))&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;+&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;']'&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; v&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;re&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;sub&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;new_char&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="str"&gt;''&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; str&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;vals&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;))&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; csv_write&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;writerow&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;([&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;keys&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="str"&gt;""&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;+&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;v&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;+&lt;/SPAN&gt;&lt;SPAN class="str"&gt;""&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;])&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;
f&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;close&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;()&lt;/SPAN&gt;


&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:34:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189967#M14589</guid>
      <dc:creator>benberman</dc:creator>
      <dc:date>2021-12-11T09:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: Writing out comma separated values in a single cell in spreadsheet</title>
      <link>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189968#M14590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So in essence then, you are saying ...Robert's initial suggestion of wrapping the string in quotes if it contains commas... was indeed correct... for those that my run into this problem in the future. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2015 06:27:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189968#M14590</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-04-27T06:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: Writing out comma separated values in a single cell in spreadsheet</title>
      <link>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189969#M14591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The correct response is that the csv module MUST be used in order to complete this task. As I have clearly indicated in my full solution, simply wrapping the values in quotes will not work unless the csv module is appropriately used.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2015 07:01:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189969#M14591</guid>
      <dc:creator>benberman</dc:creator>
      <dc:date>2015-04-27T07:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: Writing out comma separated values in a single cell in spreadsheet</title>
      <link>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189970#M14592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;/PRE&gt;&lt;P&gt;We will try this again for posterity...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; # for those that may encounter this problem in the future
&amp;gt;&amp;gt;&amp;gt; my_response = '"You, are indeed, wrong" and, here, is, an, example'
&amp;gt;&amp;gt;&amp;gt; f = open('c:/temp/output.csv','w')
&amp;gt;&amp;gt;&amp;gt; f.write(my_response)
&amp;gt;&amp;gt;&amp;gt; f.close()
&amp;gt;&amp;gt;&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;output in text file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"You, are indeed, wrong" and, here, is, an, example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Images... in Quattro Pro (a spreadsheet) and in notepad... But try it yourself with the code above&lt;/P&gt;&lt;P&gt;Be careful the my_response line consists of a single quote, ', followed by a double quote, ", another double quote to encapsulate the first expression and finally another quote to complete the whole thing.&lt;/P&gt;&lt;P&gt;This is standard Python stuff when trying to quote quotes...you have to mix them up ... two double or single quotes side-by-each simply encase space...the void...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="89485" alt="output.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/89485_output.png" style="width: 620px; height: 329px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="90146" alt="output2.png" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/90146_output2.png" style="width: 620px; height: 133px;" /&gt;&lt;/P&gt;&lt;P&gt;All done without the csv module, if you know what the csv module does...it makes it easier.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:34:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/writing-out-comma-separated-values-in-a-single/m-p/189970#M14592</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T09:34:06Z</dc:date>
    </item>
  </channel>
</rss>

