join用的不错

a = "Hello, world"
b = "你好,世界"
c = "How are you?"
with open(file='a.txt', mode='w', encoding='utf-8') as f:
    f.write('\n'.join([a, b, c]))
    f.write('\n' + '=' * 30)

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2022-12-23
  • 2021-09-29
  • 2022-12-23
  • 2021-09-25
  • 2021-04-15
猜你喜欢
  • 2021-11-09
  • 2022-12-23
  • 2021-09-29
  • 2021-09-13
  • 2022-12-23
  • 2022-12-23
  • 2021-08-31
相关资源
相似解决方案