参考:https://www.jb51.net/article/137644.htm
f = open('E:/test.txt','w')
f.write('hello world!')
f.close()
f = open('E:/test.txt','a')
f.write('the second writing...') #会接着写同一行,不会换行的
f.close()
f = open('E:/test.txt','a')
f.write('\nthe third writing...') #如果要换行,需要使用\n
f.close()
f = open('E:/test.txt','a')
f.writelines(['\nthe fourth writing...',',','good']) #将多个字符串写到同一行
f.close()