Edit2/8 1PM: fixed format of the code, added more detail to better understand what I am asking because I wrote this in a rush. I am making a file converter in python and for some reason it only takes the last line of the example file I made and it adds brackets "['']" I don't want in it probably because it's collected data? I don't know how to make the loop so it collects the data in each row/column and spits it back out while also keeping the csv header parts in.
info = pd.read_csv(filename)
f = open(filename)
csv_f = csv.reader(f)
header=[]
data=[]
things=[]
n = -2
m = 0
i = -1
for col in info.columns:
header.append(col)
print(header)
for row in csv_f:
data.append(row)
for things in data[1:]:
print(things)
num = len(things)
file = open('output.xml', 'w')
while num > 0:
n+=1
m+=1
i+=1
num -= 1
print("""<%s>""" % (header[i:m]))
print("""%s""" % (things[i:m]))
print("""</%s>""" % (header[i:m]))
if num > 0:
file.write("""<%s>%s</%s>""" %(header[i:m], things[i:m], header[i:m]))
else:
file.close