title: count items in an object python
body: <p>When I print the object I get:
      {'ip': 'ip', 'ip1': 'hi'}</p>
  
  <p>But if I try to print the length of that I get:</p>
  
  <pre><code>Traceback (most recent call last):
      print len(options)
  AttributeError: Values instance has no attribute '__len__'
  </code></pre>
  
  <p>I just need to know how many items are in that object (which appears to just be a dictionary).</p>
  
  <p>Here is the whole code:</p>
  
  <pre><code>#!/usr/bin/python
  
  from inspect import getmembers
  from optparse import OptionParser
  
  
  
  parser = OptionParser()
  parser.add_option('-a', '--allow',
      action="store", dest="ip",
      help="query string", default="spam")
  
  parser.add_option('-d', '--deny',
      action="store", dest="ip1",
      help="query string", default="spam")
  
  
  options, args = parser.parse_args()
  
  print 'Query string:', options.ip
  print 'Query string:', options.ip1
  
  count=0
  for i in options:
    count+=1
  print count
  
  if 1:
    print "Max number of options 1"
    exit
  </code></pre>