del split_line[0]
// Loop through all feature-value pairs printing out pairs separated by commas (and with feature names replaced with numbers)
for field_num, value in sorted(izip([field_num_dict[field_name] for field_name in split_line[::2]],
[float(value) if value != "N/A" else 0.0 for value in split_line[1::2]])):
// Check for duplicates
if field_num in line_fields:
field_name = (field_name for field_name, f_num in field_num_dict.items() if f_num == field_num).next()
After Change
if len(split_line) > 1:
del split_line[0]
// Loop through all feature-value pairs printing out pairs separated by commas (and with feature names replaced with numbers)
for field_num, value in sorted(izip((field_num_dict[field_name] for field_name in islice(split_line, 0, None, 2)),
(float(value) if value != "N/A" else 0.0 for value in islice(split_line, 1, None, 2)))):
// Check for duplicates
if field_num in line_fields: