From: Brian Freeman Date: Mon, 7 Jan 2019 16:38:42 +0000 (-0500) Subject: Add csv file helper X-Git-Tag: 4.0.0-ONAP~15 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=ac727429e432d51893b487f350e4a8e2811d04a2;p=testsuite%2Fpython-testing-utils.git Add csv file helper Issue-ID: INT-797 Change-Id: I187b1c882d087eee5df9ec49f7261c2b07332f28 Signed-off-by: Brian Freeman --- diff --git a/eteutils/csvLibrary.py b/eteutils/csvLibrary.py new file mode 100644 index 0000000..b38b4a5 --- /dev/null +++ b/eteutils/csvLibrary.py @@ -0,0 +1,16 @@ +import csv +class csvLibrary(object): + + def read_csv_file(self, filename): + '''This creates a keyword named "Read CSV File" + + This keyword takes one argument, which is a path to a .csv file. It + returns a list of rows, with each row being a list of the data in + each column. + ''' + data = [] + with open(filename, 'rb') as csvfile: + reader = csv.reader(csvfile) + for row in reader: + data.append(row) + return data