In python, how can I get how many groups I get in regular expression
<p>In python, I can use regular expression like this:</p>

<pre><code>prog = re.compile(pattern)
result = prog.match(string)
</code></pre>

<p>And I can result.groups(0), result.groups(0), ... etc.</p>

<p>How can I find out how many groups in the result?  I tried 'len(result.groups)', but I get:</p>

<pre><code>TypeError: object of type 'builtin_function_or_method' has no len()
</code></pre>
