""" Generator demo for CTAC 2006 Python workshop

Ole Nielsen 2006
"""


def get_html_links(filename):
    """Scan html file and yield links
    """ 

    fid = open(filename)
    for line in fid.readlines():
        start_index = line.find('<a href="http')
        
        if start_index >= 0:
            end_index = line.find('">', start_index)

            yield line[start_index:end_index]

      

# Main program
for link in get_html_links('python_java_side-by-side.html'):
    print link



        
