I am trying to store my run time output into a CSV file. It stores only one data, but I want to store all of them.
My code,
path = self.paths[src][dst]
next_hop = path[path.index(dpid) + 1]
out_port = self.network[dpid][next_hop]['port']
print("path: ", path)
writer=csv.writer(open('pth.csv','wb'))
writer.writerow([path]);
The output is,
['62:61:5f:80:dc:ca', 5, 4, 1, '46:22:26:36:96:48']
['62:61:5f:80:dc:ca', 5, 4, 1, '46:22:26:36:96:48']
['62:61:5f:80:dc:ca', 5, 4, 1, '46:22:26:36:96:48']
['62:61:5f:80:dc:ca', 5, 4, 1, '46:22:26:36:96:48']
['62:61:5f:80:dc:ca', 5, 4, 1, '46:22:26:36:96:48']
['46:22:26:36:96:48', 1, 4, 5, '62:61:5f:80:dc:ca']
['46:22:26:36:96:48', 1, 4, 5, '62:61:5f:80:dc:ca']
['46:22:26:36:96:48', 1, 4, 5, '62:61:5f:80:dc:ca']
It would be helpful if you could give a hint