Save data to txt

join with good

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)

 

Guess you like

Origin www.cnblogs.com/wt7018/p/11899484.html