In a python code I do the following:
x1=[]
y1=[]
y2=[]
y3=[]
y4=[]
for line in res_file_1.readlines():
ll=string.split(line)
x1.append(float(ll[0]))
y1.append(float(ll[1]))
y2.append(float(ll[2]))
y3.append(float(ll[3]))
y4.append(float(ll[4]))
So it reads 4 columns of a file and stores values in the different "y" arrays. I wonder how could I do this more general, i.e., when I do not know whether the input file will contain 4, or 16 or 2000 columns
UPDATE:
Later I need to plot data with matplotlib, so I usually do:
ax.plot(x1,y1,'ks',color='red')
ax.plot(x1,y2,'ks',color='green')
ax.plot(x1,y3,'ks',color='blue')
How can I do the plot for the undefined number of columns (and colors)?
