First time here? Check out the FAQ!
answered 2010-10-23 01:51:27 +0100
with open("outputfilepath", 'w') as fp: for line in iterable: #assuming line is str with \n print >> fp, line #implicit fp.close() here as "with" scope ends.