Use the zip
function, along with tuple unpacking:
for x, y in zip(xs, ys):
print x, y
In your case, depending on what you need the xs
and ys
for, you could have iterated through the csv.reader
directly:
with filein as f:
reader=csv.reader(f)
for x, y in reader:
print x, y
The zip(xs, ys)
line was effectively reversing your xs, ys = zip(*reader)
line.