Answer the question
In order to leave comments, you need to log in
How to write multiple lists into one csv in Python?
Greetings friends! I read the documentation, but I confess, I can’t figure out how to combine and write three lists into one csv, so that each list is in a separate column. (I can write down one list)
Yes:
title = list 1
url = list 2
img = list 3
def save():
with open('D:\spisok.csv', 'w', newline='') as file:
csv_writer = csv.writer(file)
for item in title:
csv_writer.writerow([item])
Answer the question
In order to leave comments, you need to log in
I haven't checked the correctness of the code, but I assume so
RESULTS = [title, url, img]
csv_writer.writerows(RESULTS)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question