need some regular expression help

Fredrik Lundh fredrik at pythonware.com
Sun Oct 8 06:15:51 EDT 2006


bearophileHUGS at lycos.com wrote:

 > The dict solution looks better, but this may be faster:

it's slightly faster, but both your alternatives are about 10x slower 
than a straightforward:

def balanced(txt):
     return txt.count("(") == txt.count(")")

</F>




More information about the Python-list mailing list