title: Python 3.x AttributeError: 'NoneType' object has no attribute 'groupdict'
body: <p>Being a beginner in python I might be missing out on some kind of basics. But I was going through one of the codes from a project and happened to face this :</p>
  
  <blockquote>
    <p>AttributeError: 'NoneType' object has no attribute 'groupdict'</p>
  </blockquote>
  
  <p>Following is the section of code,re-phrased though,still this does result in the same problem.</p>
  
  <pre><code>import re
  
  fmt = (r"\+((?P&lt;day&gt;\d+)d)?((?P&lt;hrs&gt;\d+)h)?((?P&lt;min&gt;\d+)m)?"
         r"((?P&lt;sec&gt;\d+)s)?((?P&lt;ms&gt;\d+)ms)?$")
  p = re.compile(fmt)
  match = p.search('Total run time: 9h 34m 9s 901ms realtime, 7h 6m 29s 699ms uptime')
  try:
      d = match.groupdict()
  except IndexError:
      print("exception here")
  </code></pre>