X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Ftools%2Fpresentation%2Fpal_utils.py;fp=resources%2Ftools%2Fpresentation%2Fpal_utils.py;h=1da3350fe1676414ad7014e62ed3ce2f58321c44;hb=6b353c8ae146ed5ce1c30addff6744954ed4d305;hp=45fd2770480adeb7a8e6feb67c1583dc1f80c613;hpb=baaf9477dd51a8878f10a0763024df7c435a268c;p=csit.git diff --git a/resources/tools/presentation/pal_utils.py b/resources/tools/presentation/pal_utils.py index 45fd277048..1da3350fe1 100644 --- a/resources/tools/presentation/pal_utils.py +++ b/resources/tools/presentation/pal_utils.py @@ -297,24 +297,27 @@ def classify_anomalies(data): return classification, avgs -def convert_csv_to_pretty_txt(csv_file_name, txt_file_name): +def convert_csv_to_pretty_txt(csv_file_name, txt_file_name, delimiter=u","): """Convert the given csv table to pretty text table. :param csv_file_name: The path to the input csv file. :param txt_file_name: The path to the output pretty text file. + :param delimiter: Delimiter for csv file. :type csv_file_name: str :type txt_file_name: str + :type delimiter: str """ txt_table = None with open(csv_file_name, u"rt") as csv_file: - csv_content = csv.reader(csv_file, delimiter=u',', quotechar=u'"') + csv_content = csv.reader(csv_file, delimiter=delimiter, quotechar=u'"') for row in csv_content: if txt_table is None: txt_table = prettytable.PrettyTable(row) else: txt_table.add_row(row) txt_table.align[u"Test case"] = u"l" + txt_table.align[u"RCA"] = u"l" if txt_table: with open(txt_file_name, u"wt") as txt_file: txt_file.write(str(txt_table))