无论是writelines,或者是write,
f.write(line for line in list)
f.writelines(list)
都不会自动换行!!
如需自动换行,
都需要手动加上'\n'
f.writelines(line + '\n' for line in list)
无论是writelines,或者是write,
f.write(line for line in list)
f.writelines(list)
都不会自动换行!!
如需自动换行,
都需要手动加上'\n'
f.writelines(line + '\n' for line in list)