So I've created Python code that scrapes several different websites and then does some things with the lists created. I know how to turn a list into a string and how to then write a csv file from the string. My question is, can I write several strings into the same csv file and put each in its own row with a unique header? The code below will get all the data into the csv file, but not in its own rows.
str1 = "\n".join(data1)
str2 = "\n".join(data2)
str3 = "\n".join(matches)
now = datetime.datetime.now()
now_str = now.strftime("%Y-%m-%d-%H-%M")
outfilename = 'data-{}.csv'.format(now_str)
outpath = 'data/'
outFile = open(outfilename, 'write')
outFile.write(str1)
outfile.write(str2)
outfile.write(str3)
outFile.close()
data1,data2, andmatchesare, or what output you are now getting.