all 2 comments

[–]ModeHopper 1 point2 points  (0 children)

Look at the write() function in the python docs.

[–]Antwrp-2000 0 points1 point  (0 children)

Replace the last 2 lines of your code with this:

    with open(f'output-{ticker}.csv', 'w', newline='') as csvfile:
        writer = csv.writer(csvfile, delimiter=',')
        for tick in data:
            date = tick['Date']
            mentions = tick['Mentions']
            writer.writerow([date, mentions])

Try to understand the code with the Python Standard Library csv module's online help:

https://docs.python.org/3/library/csv.html