Apr-11-2017, 11:14 AM
(Apr-10-2017, 08:19 PM)tkj80 Wrote:import csv with open('foo.csv') as csvfile: reader = csv.reader(csvfile, skipinitialspace=True, delimiter=',') for row in reader: if row == []: pass else: csvImport2.append(row)This code helped me to eliminate [] that seems to possibly came from new line when I tried to read the csv data into Python.
When I opened the csv file in notepad, it does come out as below:
So I'm not sure why without this line of code: if row == []: pass
Output:3-March-17, a, b, c 16-February-17, d, e, f 19-January-17, g, h, i
when I try to read the data from the csv file, it would look like this:
Thank you for your help!!
Output:[['3-March-17', 'a', 'b', 'c'] [] ['16-February-17', 'd', 'e', 'f'] [] ['19-January-17', 'g', 'h', 'i']]
Can you zip the CSV (or a small part that sill exhibits the problem) and attach it here?
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Your one-stop place for all your GIMP needs: gimp-forum.net