<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
    <title></title>
  </head>
  <body bgcolor="#ffffff" text="#000000">
    On 9/17/2010 9:08 AM, M. 427 wrote:
    <blockquote cite="mid:1284728886.6961.1.camel@mechazawa" type="cite">
      <pre wrap="">Hello,

(I am very new to python)
I built a dictionary d={} of lists similar to this :

d = { 
'a': ['apricot', 'apple'],
'b': ['beach', 'bear', 'bottle'],
'c': ['cold', 'cook', 'coleslaw'],
'd': ['deep'],
'e': ['expression', 'elephant']
}

Now i want to go through this dictionary and remove all rows containing
only one entry. How should I do that?
</pre>
    </blockquote>
    <br>
    We like to help when you tell us what part(s) of the answer you
    know. There are 4 things involved here:<br>
    1 - How to get a list of all the key-value pairs in a dictionary.<br>
    2 - How to loop thru that list.<br>
    3 - How to get the length of a value's list.<br>
    4 - How to test that for equal to 1.<br>
    5- How to delete a dictionary entry knowing the key.<br>
    <br>
    Which of those do you know? Which do you need help with?<br>
    <blockquote cite="mid:1284728886.6961.1.camel@mechazawa" type="cite">
      <pre wrap="">

Question 2 : where should I have found this answer myself? (apart from
here)
</pre>
    </blockquote>
    It is hard to give a specific answer since we don't know what you
    don't know.<br>
    <br>
    I suspect most tutorials will give you the answers.<br>
    <br>
    In the Python Reference <i>6.8 Mapping Type - dict </i>it tells
    you the answers to 1 and 5.<br>
    <br>
    In the Python Reference <i>6.6.4. Mutable Sequence Types</i> it
    tells you the answer to 3.<br>
    <br>
    In the Python Reference <i>5.9 Comparisons</i> it tells you the
    answer to 4.<br>
    <br>
    Regarding 3 there are several ways to loop through a sequence.
    Tutorials explain these.<br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Bob Gailer
919-636-4239
Chapel Hill NC</pre>
  </body>
</html>