<?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 help inserting characters in simple python code in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/help-inserting-simple-characters/m-p/1151075#M63972</link>
    <description>&lt;P&gt;&lt;STRONG&gt;For example, for a string hello, the result should be _h_e_l_l_o_.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;word = "hello"&lt;BR /&gt;new_word = "_"&lt;BR /&gt;for letter in word:&lt;BR /&gt;new_word = letter + "_"&lt;BR /&gt;print(new_word)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;but i am not getting&amp;nbsp;_h_e_l_l_o_. this. what am i doing wrong ? how do i fix this ?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;thanks&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 06 Mar 2022 17:59:37 GMT</pubDate>
    <dc:creator>Chelsea_Trusdell</dc:creator>
    <dc:date>2022-03-06T17:59:37Z</dc:date>
    <item>
      <title>help inserting simple characters</title>
      <link>https://community.esri.com/t5/python-questions/help-inserting-simple-characters/m-p/1151077#M63970</link>
      <description />
      <pubDate>Mon, 07 Mar 2022 09:16:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-inserting-simple-characters/m-p/1151077#M63970</guid>
      <dc:creator>Chelsea_Trusdell</dc:creator>
      <dc:date>2022-03-07T09:16:46Z</dc:date>
    </item>
    <item>
      <title>help Inserting simple characters in codes</title>
      <link>https://community.esri.com/t5/python-questions/help-inserting-simple-characters/m-p/1151074#M63974</link>
      <description>&lt;P&gt;&lt;STRONG&gt;For example, for a string hello, the result should be _h_e_l_l_o_.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;word = "hello"&lt;BR /&gt;new_word = "_"&lt;BR /&gt;for letter in word:&lt;BR /&gt;new_word = letter + "_"&lt;BR /&gt;print(new_word)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;but i am not getting&amp;nbsp;_h_e_l_l_o_. this. what am i doing wrong ?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;thanks&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2022 17:57:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-inserting-simple-characters/m-p/1151074#M63974</guid>
      <dc:creator>Chelsea_Trusdell</dc:creator>
      <dc:date>2022-03-06T17:57:58Z</dc:date>
    </item>
    <item>
      <title>help inserting characters in simple python code</title>
      <link>https://community.esri.com/t5/python-questions/help-inserting-simple-characters/m-p/1151075#M63972</link>
      <description>&lt;P&gt;&lt;STRONG&gt;For example, for a string hello, the result should be _h_e_l_l_o_.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;word = "hello"&lt;BR /&gt;new_word = "_"&lt;BR /&gt;for letter in word:&lt;BR /&gt;new_word = letter + "_"&lt;BR /&gt;print(new_word)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;but i am not getting&amp;nbsp;_h_e_l_l_o_. this. what am i doing wrong ? how do i fix this ?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;thanks&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2022 17:59:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-inserting-simple-characters/m-p/1151075#M63972</guid>
      <dc:creator>Chelsea_Trusdell</dc:creator>
      <dc:date>2022-03-06T17:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: help inserting simple characters in python</title>
      <link>https://community.esri.com/t5/python-questions/help-inserting-simple-characters/m-p/1151078#M63971</link>
      <description>&lt;LI-CODE lang="python"&gt;"".join([f"_{i}" for i in "hello"])+"_"
 '_h_e_l_l_o_'&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 06 Mar 2022 18:10:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-inserting-simple-characters/m-p/1151078#M63971</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-03-06T18:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: help inserting characters in simple python code</title>
      <link>https://community.esri.com/t5/python-questions/help-inserting-simple-characters/m-p/1151079#M63973</link>
      <description>&lt;P&gt;Look into Python’s assignment operators.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2022 18:13:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-inserting-simple-characters/m-p/1151079#M63973</guid>
      <dc:creator>AndyAnderson</dc:creator>
      <dc:date>2022-03-06T18:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: help inserting simple characters in python</title>
      <link>https://community.esri.com/t5/python-questions/help-inserting-simple-characters/m-p/1151081#M63975</link>
      <description>&lt;P&gt;perhaps missing the augmented assignment operator +=&lt;/P&gt;&lt;LI-CODE lang="python"&gt;word = "hello"
new_word = "_"
for letter in word:
  new_word += letter + "_"
print(new_word)&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 06 Mar 2022 18:31:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-inserting-simple-characters/m-p/1151081#M63975</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2022-03-06T18:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: help inserting simple characters in python</title>
      <link>https://community.esri.com/t5/python-questions/help-inserting-simple-characters/m-p/1151083#M63976</link>
      <description>&lt;P&gt;Similar, but slightly different, to another response using &lt;FONT face="courier new,courier"&gt;str.join()&lt;/FONT&gt; and string formatting:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;&amp;gt;&amp;gt;&amp;gt; word = "hello"
&amp;gt;&amp;gt;&amp;gt; print(f"_{'_'.join(word)}_")
_h_e_l_l_o_
&amp;gt;&amp;gt;&amp;gt; &lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 06 Mar 2022 19:05:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-inserting-simple-characters/m-p/1151083#M63976</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2022-03-06T19:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: help inserting simple characters in python</title>
      <link>https://community.esri.com/t5/python-questions/help-inserting-simple-characters/m-p/1151131#M63977</link>
      <description>&lt;P&gt;thank you both!&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 05:44:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-inserting-simple-characters/m-p/1151131#M63977</guid>
      <dc:creator>Chelsea_Trusdell</dc:creator>
      <dc:date>2022-03-07T05:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: help inserting simple characters in python</title>
      <link>https://community.esri.com/t5/python-questions/help-inserting-simple-characters/m-p/1151142#M63979</link>
      <description>&lt;P&gt;To avoid leading and trailing join symbols, you can try this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;word = "hello"
joinword = ""

for (idx,letter) in enumerate(word):
   joinword += letter
   if idx &amp;lt; len(word)-1:
      joinword += "_"

print(joinword)&lt;/LI-CODE&gt;&lt;P&gt;This will print &lt;FONT face="courier new,courier"&gt;'h_e_l_l_o'&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 06:33:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-inserting-simple-characters/m-p/1151142#M63979</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-03-07T06:33:42Z</dc:date>
    </item>
  </channel>
</rss>

