<?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: Missing values in a dictionary? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/missing-values-in-a-dictionary/m-p/663015#M51530</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your keys have to be unique. The key: value pair&amp;nbsp; "10125: 1" is getting overwritten by the pair "10125: 2"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 May 2020 11:56:26 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2020-05-29T11:56:26Z</dc:date>
    <item>
      <title>Missing values in a dictionary?</title>
      <link>https://community.esri.com/t5/python-questions/missing-values-in-a-dictionary/m-p/663014#M51529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Somehow I'm not able to add all values in a search cursor to a dictionary - one value pair is missing? What is my mistake?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Dict1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;self&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;

        &lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SearchCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;outIntersect&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"FID_Anbinden1"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"FLURSTUECKSTEXT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
                &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"{} - {}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
                myKey &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
                myValue &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
                myDict&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;myKey&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; myValue
                &lt;SPAN class="comment token"&gt;# myDict.update({myKey: myValue})&lt;/SPAN&gt;

        &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; myDict&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This leads to this output (as well as .update in line 9):&lt;/P&gt;&lt;P&gt;1 - 10125&lt;BR /&gt;1 - 10079&lt;BR /&gt;1 - 10337/2&lt;BR /&gt;2 - 10125&lt;BR /&gt;{u'10079': 1, u'10337/2': 1, u'10125': 2}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u'10125':1 is missing?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:02:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/missing-values-in-a-dictionary/m-p/663014#M51529</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2021-12-12T04:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: Missing values in a dictionary?</title>
      <link>https://community.esri.com/t5/python-questions/missing-values-in-a-dictionary/m-p/663015#M51530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your keys have to be unique. The key: value pair&amp;nbsp; "10125: 1" is getting overwritten by the pair "10125: 2"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2020 11:56:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/missing-values-in-a-dictionary/m-p/663015#M51530</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2020-05-29T11:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: Missing values in a dictionary?</title>
      <link>https://community.esri.com/t5/python-questions/missing-values-in-a-dictionary/m-p/663016#M51531</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2020 12:01:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/missing-values-in-a-dictionary/m-p/663016#M51531</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2020-05-29T12:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: Missing values in a dictionary?</title>
      <link>https://community.esri.com/t5/python-questions/missing-values-in-a-dictionary/m-p/663017#M51532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you need to have multiple values for each key, then use a list rather than a value, like "10125: [1,2]"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See this post: &lt;A class="link-titled" href="https://stackoverflow.com/questions/28749143/adding-new-key-to-dictionary-overwrites-all-previously-stored-keys-with-new-keys" title="https://stackoverflow.com/questions/28749143/adding-new-key-to-dictionary-overwrites-all-previously-stored-keys-with-new-keys"&gt;python - Adding new key to dictionary overwrites all previously stored keys with new keys values - Stack Overflow&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2020 12:02:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/missing-values-in-a-dictionary/m-p/663017#M51532</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2020-05-29T12:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: Missing values in a dictionary?</title>
      <link>https://community.esri.com/t5/python-questions/missing-values-in-a-dictionary/m-p/663018#M51533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah ok, will try to use a list. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2020 12:06:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/missing-values-in-a-dictionary/m-p/663018#M51533</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2020-05-29T12:06:54Z</dc:date>
    </item>
  </channel>
</rss>

