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