Writing a list of tuples to a text file in Python,f.write(' '.join(str(s) for s in t) + '\n')