How to write to text file python 3?
I want to read each line and write to outputDoc1.txt for line1 , outputDoc2.txt for line1, outputDoc3.txt for line1
line1 = "Alright, I think I understand. Thank you again"
line2 = " just had to use join to separate the data"
line3 = " whether that's desirable or not I suppose is down to the OP"
path = "C:\\Users\\subashini.u\\Desktop\\"
l=["line1","line2","line3"]
count = 0
for txt_file in l:
count += 1
for x in range(count):
with open(path + "outputDoc%s.txt" % x) as output_file:
output_file.write(txt_file)
#shutil.copyfileobj(file_response.raw, output_file)
output_file.close()