<?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 Copying Text from Item Description on ITEM ID Page in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/copying-text-from-item-description-on-item-id-page/m-p/1415473#M9937</link>
    <description>&lt;P&gt;Hello, I am trying to use the ArcGIS API for Python to read the Description from the Overview page on for an item.&lt;/P&gt;&lt;P&gt;For reference, the item is a .csv. We use the description to store the SQL that creates the .csv and I want to be able to read the SQL text from the description in order to execute it on my database and then updated and re-publish the .csv&lt;/P&gt;&lt;P&gt;Using the following code, I can read the description, but it returns it in HTML format:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
from pprint import pprint

gis = GIS("https://myURL.com", agol_username, agol_password)
item_data = gis.content.get(my_item_id)
data = item_data.description
pprint(data)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am wondering if there is a way to print just the text from the Description? Something like (although 'text' is not a method in the API)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;data = item_data.description.text&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions. I can't seem to find anything in the docs.&lt;/P&gt;</description>
    <pubDate>Thu, 25 Apr 2024 18:40:47 GMT</pubDate>
    <dc:creator>MikeMacRae</dc:creator>
    <dc:date>2024-04-25T18:40:47Z</dc:date>
    <item>
      <title>Copying Text from Item Description on ITEM ID Page</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/copying-text-from-item-description-on-item-id-page/m-p/1415473#M9937</link>
      <description>&lt;P&gt;Hello, I am trying to use the ArcGIS API for Python to read the Description from the Overview page on for an item.&lt;/P&gt;&lt;P&gt;For reference, the item is a .csv. We use the description to store the SQL that creates the .csv and I want to be able to read the SQL text from the description in order to execute it on my database and then updated and re-publish the .csv&lt;/P&gt;&lt;P&gt;Using the following code, I can read the description, but it returns it in HTML format:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
from pprint import pprint

gis = GIS("https://myURL.com", agol_username, agol_password)
item_data = gis.content.get(my_item_id)
data = item_data.description
pprint(data)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am wondering if there is a way to print just the text from the Description? Something like (although 'text' is not a method in the API)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;data = item_data.description.text&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions. I can't seem to find anything in the docs.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2024 18:40:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/copying-text-from-item-description-on-item-id-page/m-p/1415473#M9937</guid>
      <dc:creator>MikeMacRae</dc:creator>
      <dc:date>2024-04-25T18:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: Copying Text from Item Description on ITEM ID Page</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/copying-text-from-item-description-on-item-id-page/m-p/1415539#M9939</link>
      <description>&lt;P&gt;Maybe something like this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import re
from arcgis.gis import GIS
from pprint import pprint

gis = GIS("https://myURL.com", agol_username, agol_password)
item_data = gis.content.get(my_item_id)
data = item_data.description

pattern = re.compile("&amp;lt;.*?&amp;gt;")
clean_text = re.sub(pattern, "", data)
pprint(clean_text)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sounds like you just need to strip out the html tags, I think. I'm not sure what your description looks like, but you may also have to account for some other things like newline. Using print might yield better results in this case.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2024 19:51:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/copying-text-from-item-description-on-item-id-page/m-p/1415539#M9939</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2024-04-25T19:51:37Z</dc:date>
    </item>
  </channel>
</rss>

