(url, limit=0)
Generate parent urls above 'limit' level (0 = base)
Generate parent urls above 'limit' level (0 = base)
Generate parent urls above limit level ( 0 = base )
def parent_urls(url, limit=0):
    """Generate parent urls above 'limit' level (0 = base)"""
    # Clean up the url
    url = normalize_url(url.rstrip('/'))
    # Yield parent urls from second-last level down to 'limit'
    for i in range(1, url.count('/') + 1 - limit):
        yield url.rsplit('/', i)[0] + '/'
def parent_urls ( url , limit = 0 ) : # Clean up the url url = normalize_url ( url . rstrip ( '/' ) ) # Yield parent urls from second-last level down to 'limit' for i in range ( 1 , url . count ( '/' ) + 1 - limit ) : yield url . rsplit ( '/' , i ) [ 0 ] + '/'