python writelines不换行解决方法

参考代码:

data=['one','two','three']
with open('data.txt','w') as fw:
    fw.writelines([item+'\n' for item in data])

标签: fw、writelines、item、data、换行、面试
  • 回复
隐藏