This seems to work as a starter.

def return_files(file_list):
    """ Take a list of files and return file when called 

        Calling function to supply attributes   
    """
    for filename in sorted(file_list):
        with open(dir_path + filename) as fd:
            doc = xmltodict.parse(fd.read())
            for item in doc['meeting']['race']:
                yield item


my_generator = return_files(file_list)

def gets_id():
    for value in my_generator:
        for asset in value['nomination']:
            print(asset['@id'])
        
gets_id()

Cheers

Sayth

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to