Say I have two lists: a=[1,2,3] b=[4,5,6] I want to write them into a text file such that I obtain a two column text file:
Try this:
file = open("list.txt", "w") for index in range(len(a)): file.write(str(a[index]) + " " + str(b[index]) + "\n") file.close()