<?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: string.format  escaping {? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/string-format-nbsp-escaping/m-p/160923#M12304</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you just want a string with the value: 'I am going {nuts}'.format(nuts= 'crazy over this')&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Try encapsulating it in double quotes like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;s = "'I am going {nuts}'.format(nuts= 'crazy over this')"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Or you might need to somehow concatenate the string like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;s = 'I am going {wild} ' + '{nuts}'.format(nuts= 'crazy {nutty} over this') + ' for real!'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print s&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'I am going {wild} crazy {nutty} over this for real!'&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Oct 2012 18:31:34 GMT</pubDate>
    <dc:creator>ClayPerry</dc:creator>
    <dc:date>2012-10-03T18:31:34Z</dc:date>
    <item>
      <title>string.format  escaping {?</title>
      <link>https://community.esri.com/t5/python-questions/string-format-nbsp-escaping/m-p/160921#M12302</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How does one use { and } in a string that is being formatted?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;s = 'I am going {nuts}'.format(nuts= 'crazy over this') #except my string would have curly braces in it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If using the curlys in the string the format method thinks I want to swap something.&amp;nbsp; Is there a way to escape it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Oct 2012 17:03:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-format-nbsp-escaping/m-p/160921#M12302</guid>
      <dc:creator>KevinBell</dc:creator>
      <dc:date>2012-10-03T17:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: string.format  escaping {?</title>
      <link>https://community.esri.com/t5/python-questions/string-format-nbsp-escaping/m-p/160922#M12303</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;{{ and }} give you single curlys.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Oct 2012 17:54:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-format-nbsp-escaping/m-p/160922#M12303</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2012-10-03T17:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: string.format  escaping {?</title>
      <link>https://community.esri.com/t5/python-questions/string-format-nbsp-escaping/m-p/160923#M12304</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you just want a string with the value: 'I am going {nuts}'.format(nuts= 'crazy over this')&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Try encapsulating it in double quotes like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;s = "'I am going {nuts}'.format(nuts= 'crazy over this')"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Or you might need to somehow concatenate the string like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;s = 'I am going {wild} ' + '{nuts}'.format(nuts= 'crazy {nutty} over this') + ' for real!'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print s&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'I am going {wild} crazy {nutty} over this for real!'&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Oct 2012 18:31:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-format-nbsp-escaping/m-p/160923#M12304</guid>
      <dc:creator>ClayPerry</dc:creator>
      <dc:date>2012-10-03T18:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: string.format  escaping {?</title>
      <link>https://community.esri.com/t5/python-questions/string-format-nbsp-escaping/m-p/160924#M12305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;{{ and }} give you single curlys.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Neat, Jason! &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Interactive Python example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; 'I am going {{{nuts}}}'.format(nuts= 'crazy over this')
'I am going {crazy over this}'
&amp;gt;&amp;gt;&amp;gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:28:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-format-nbsp-escaping/m-p/160924#M12305</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-11T08:28:03Z</dc:date>
    </item>
  </channel>
</rss>

