import os
filename = '/tmp/test.txt'
with open(filename,'w') as file_object:
file_object.write("123\n")
file_object.write("456\n")
file_object.close()
file_path="/tmp/test.txt"
str_list=['11','22','33']
f=open(file_path, "w")
for line in str_list:
f.write(line)
f.write('\n')
网友评论