<?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: read and write to variable from DICT in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/read-and-write-to-variable-from-dict/m-p/1239113#M8129</link>
    <description>&lt;P&gt;Thank you very much&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/86309"&gt;@EarlMedina&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Dec 2022 13:05:34 GMT</pubDate>
    <dc:creator>kapalczynski</dc:creator>
    <dc:date>2022-12-08T13:05:34Z</dc:date>
    <item>
      <title>read and write to variable from DICT</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/read-and-write-to-variable-from-dict/m-p/1238871#M8122</link>
      <description>&lt;P&gt;I have this dictionary object&lt;/P&gt;&lt;P&gt;{'owner': {'email': 'email&lt;SPAN&gt;@address'},&lt;/SPAN&gt;&lt;SPAN&gt;'users': [{'username': 'FrankT','memberType': 'member'},&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;{'username': 'Chris','memberType': 'admin'}]}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="inherit"&gt;I want to read it and get the Email from 'owner' key to a single variable &lt;/FONT&gt;and&lt;FONT face="inherit"&gt;&amp;nbsp;then FOR loop it through &lt;/FONT&gt;the&lt;FONT face="inherit"&gt;&amp;nbsp;second Key 'users' and get a variable for 'username' - 'memberType'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="inherit"&gt;For instance I might want to read each of the users in the users Key and only write those that have membertype set to Admin.... Populate an array or dict ....&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="inherit"&gt;Or simply loop through the users key and make a comma delimited string of the user names&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="inherit"&gt;I just dont know how to read and loop through the keys...&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 21:36:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/read-and-write-to-variable-from-dict/m-p/1238871#M8122</guid>
      <dc:creator>kapalczynski</dc:creator>
      <dc:date>2022-12-07T21:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: read and write to variable from DICT</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/read-and-write-to-variable-from-dict/m-p/1238945#M8127</link>
      <description>&lt;P&gt;Do you mind providing an example of what you want to end up with? I want to make sure I'm understanding your needs. This was my understanding of what you're asking for:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;data = {'owner': {'email': 'email@address'},'users': [{'username': 'FrankT','memberType': 'member'}, {'username': 'Chris','memberType': 'admin'}, {'username': 'Test','memberType': 'admin'}]}

email = data['owner']['email']
users = data['users']
admins = [{'email': email, **user} for user in users if user['memberType'] == 'admin']&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 07 Dec 2022 22:23:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/read-and-write-to-variable-from-dict/m-p/1238945#M8127</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2022-12-07T22:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: read and write to variable from DICT</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/read-and-write-to-variable-from-dict/m-p/1239113#M8129</link>
      <description>&lt;P&gt;Thank you very much&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/86309"&gt;@EarlMedina&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 13:05:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/read-and-write-to-variable-from-dict/m-p/1239113#M8129</guid>
      <dc:creator>kapalczynski</dc:creator>
      <dc:date>2022-12-08T13:05:34Z</dc:date>
    </item>
    <item>
      <title>Re: read and write to variable from DICT</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/read-and-write-to-variable-from-dict/m-p/1239129#M8130</link>
      <description>&lt;P&gt;One question... what is the **user in the below example from you?&lt;/P&gt;&lt;PRE&gt;admins = [{'email': email, **user} for user in users if user['memberType'] == 'admin']&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 14:05:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/read-and-write-to-variable-from-dict/m-p/1239129#M8130</guid>
      <dc:creator>kapalczynski</dc:creator>
      <dc:date>2022-12-08T14:05:29Z</dc:date>
    </item>
  </channel>
</rss>

