Yield immediately instead of appending to a list.
def parse_glst_file(glst_filename):
glst_file = codecs.open(glst_filename, 'r', 'utf-8')
def parse_glst_file(glst_filename):
glst_file = codecs.open(glst_filename, 'r', 'utf-8')
try:
for line in glst_file:
line = line.strip()
try:
for line in glst_file:
line = line.strip()
name, title = parts[1].split(';', 1)
except (IndexError, ValueError):
continue
name, title = parts[1].split(';', 1)
except (IndexError, ValueError):
continue
- genre_list.append((name, title))
finally:
glst_file.close()
finally:
glst_file.close()
def import_glst_file(glst_filename):
def import_glst_file(glst_filename):