Suppose that I have a list X, and its contents to a single line of a file, i.e.
for var in X:
if var <some conditions>:
outfile.write(" "+var)
How can I do this so that each iteration of the loop is not written to a new line in the output file, i.e.
var1 var2 var3
rather than
var1
var2
var3
in outfile. I know this can be done with a print statement as print x, I can't find the equivalent for write.