I have two files that I am going to use for plotting. one contains the x,y range and another contains data.
The following is my code to get data from one file using CSV reader.
(I have data in x,y \n format in each line of file in range.dat)
import csv
with open('range.dat', 'r') as f,open('data,dat','r') as d:
reader = csv.reader(f)
reader1 = csv.reader(d)
for row in reader:
print row
x, y = map(float, row[0:2])
print [x,y]
Now the problem is I also want data from data.dat at the same time from the same row and want to append it to [x,y] such that final list will be [x,y,data]. Is there any method through which i can iterate through data.dat content in same for loop.