python loop file write line breaks code example Example: write lines python with line breaks fw.write('\n'.join(line_list) + '\n')