import matplotlib.pyplot as plt;
x = [ ];
y = [ ];
readFile = open('xy.txt','r');
for line in readFile:
# file is open with a line in variable 'line'
# do something with this line
print(line);
# split the line based on whitespace
splitUP = line.split();
print('x = ',splitUP[0],'and y = ',splitUP[1]);
# add x and y to the arrays
x.append(splitUP[0]);
y.append(splitUP[1]);
When I run it , it shows IndexError: list index out of the range