Jan-11-2017, 01:04 AM
Hello,
I have some code that reads the columns of a csv and if the column value is True, print the list as a string, which I have working. I now need to print each on a separate line and add text based on which element is present in the failed_validation_lst, such as in the output below. Any help is greatly appreciated.
I have some code that reads the columns of a csv and if the column value is True, print the list as a string, which I have working. I now need to print each on a separate line and add text based on which element is present in the failed_validation_lst, such as in the output below. Any help is greatly appreciated.
Output:Incorrect name value - A name must be placed on all orders. Please add a name.
Address included - An address must be included on all orders. Please add an address.
Telephone number present - A telephone number must be present. Please add a telephone number.
Move completed - Move is completed. No further action required.
failed_validation_lst = [] for column, val in enumerate(row): if headers[column] in ['Incorrect name value', 'Address included', 'Telephone number present', 'Move completed'] and val == 'True': failed_validation_lst.append(headers[column]) failed_validation_string = '; '.join(failed_validation_lst) print(failed_validation_string)