Marco Mariani wrote: > From the cookbook, this time. > It satisfies the requirements nicely ;) > > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691 > [... snip the ultimate general-purpose answer to the OP's question ... I really hope that's a wink up there, Marco. The poor guy was just trying to get his homework done! :> TJG