writerow takes an iterable of cells to write:

writerow(["foo", "bar", "spam"])
->
foo,bar,spam

writerows takes an iterable of iterables of cells to write:

writerows([["foo", "bar", "spam"],
           ["oof", "rab", "maps"],
           ["writerow", "isn't", "writerows"]])
->
foo,bar,spam
oof,rab,maps,
writerow,isn't,writerows

So writerow takes 1-dimensional data (one row), and writerows takes 2-dimensional data (multiple rows).

Answer from horns on Stack Overflow
🌐
Python
docs.python.org › 3 › library › csv.html
csv — CSV File Reading and Writing
Write a row with the field names (as specified in the constructor) to the writer’s file object, formatted according to the current dialect. Return the return value of the csvwriter.writerow() call used internally.
🌐
DEV Community
dev.to › thumbone › dumping-data-with-pythons-csv-dictwriter-1g0
Dumping Data with Python's CSV DictWriter - DEV Community
May 16, 2025 - The DictWriter lets you write CSV files very neatly and semantically by defining each row as a Python dict. ... import csv with open('names.csv', 'w', newline='') as csvfile: fieldnames = ['first_name', 'last_name'] writer = csv.DictWriter(csvfile, ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › writing-csv-files-in-python
Writing CSV files in Python - GeeksforGeeks
July 12, 2025 - import csv rows = [ ['Nikhil', ... has been written to {filename}") ... Writing CSV files in Python is a straightforward and flexible process, thanks to the csv module....
🌐
Python Morsels
pythonmorsels.com › csv-writing
Writing a CSV file - Python Morsels
February 14, 2023 - >>> import csv >>> csv_file = ... csv_file.close() The writerow method relies on our file's write method, which means our file contents may not be written until our file has been closed....
🌐
Vertabelo Academy
academy.vertabelo.com › course › python-csv › writing › writing › writing-to-csv-files-in-a-loop
Read and Write CSV in Python | Learn Python | Vertabelo Academy
Of course, we normally don't use writerow() for each line manually, especially when we have lots of data. Typically, we generate the data on the fly, or have the data pre-calculated and stored in a list of lists. In such cases, we can use a for loop: data_to_save = [ ['Author', 'Title', 'Pages'], ['John Smith', 'Keep holding on', '326'], ['Erica Coleman', 'The beauty is the beast', '274'] ] with open('books.csv', mode='w', newline='') as csv_file: csv_writer = csv.writer(csv_file) for row in data_to_save: csv_writer.writerow(row)
🌐
CodeSignal
codesignal.com › learn › courses › parsing-table-data › lessons › writing-table-data-to-csv-files-using-python
Writing Table Data to CSV Files Using Python
import csv data = [ ['Name', 'Age', 'Occupation'], ['John', '28', 'Engineer'], ['Alice', '34', 'Doctor'], ['Bob', '23', 'Artist'] ] output_file_path = 'output.csv' with open(output_file_path, 'w', newline='') as csvfile: csv_writer = csv.writer(csvfile) csv_writer.writerows(data) print(f"Data written to {output_file_path} as a CSV.") ... Data written to output.csv as a CSV. By running this code, you will have generated a CSV file named output.csv in your current directory, containing your table data. ... Congratulations on completing the course! You are now equipped with the skills to read, organize, and write table data across both text and CSV files using Python.
Find elsewhere
🌐
Medium
medium.com › @hariprakashh174 › mastering-csv-file-handling-in-python-a-complete-guide-1906cfbd53e0
Mastering CSV File Handling in Python: A Complete Guide | by HARIPRAKASH K | Medium
October 7, 2025 - CSV files are commonly used to ... 'mode') as alias_name: ... writerow(): writerow is a inbuilt function which is used to write a single line of row into the csv file....
🌐
Medium
medium.com › @3valuedlogic › using-python-csv-2-basic-writing-8853ea384fe6
Using Python CSV #2— Basic Writing | by David W. Agler | Medium
December 21, 2022 - writer.writerows(my_list) ... A delimiter can be specified as a parameter in the csv.writer function (the default is the comma). A common delimiter is '\t' (tabbed).
🌐
Python Tutorial
pythontutorial.net › home › python basics › python write csv file
How to Write to CSV Files in Python
March 30, 2025 - Finally, write data rows to the CSV file using the writerows() method. Use the CSV Writer or the DictWriter class to write data to a CSV file.
🌐
Python Beginners
python-adv-web-apps.readthedocs.io › en › latest › csv.html
CSV Files — Python Beginners documentation
Using json.dumps() converts a Python value into a string of JSON data. In the example above, new_json would be that new string. Call the open() function to return a File object for reading or for writing · When and where to add parameters such as 'w', newline='', encoding='utf-8' When to use each one of these (all have different purposes): csv.reader() csv.writer() csv.DictReader() csv.DictWriter() How to use: .writerow() .writerows() The purpose of the built-in json module ·
🌐
Note.nkmk.me
note.nkmk.me › home › python
Read and Write CSV Files in Python | note.nkmk.me
August 6, 2023 - Add an item to a list in Python (append, extend, insert) l = [[11, 12, 13, 14], [21, 22, 23, 24], [31, 32, 33, 34]] header = ['', 'a', 'b', 'c', 'd'] index = ['ONE', 'TWO', 'THREE'] with open('data/temp/sample_writer_header_index.csv', 'w') as f: writer = csv.writer(f) writer.writerow(header) for i, row in zip(index, l): writer.writerow([i] + row) with open('data/temp/sample_writer_header_index.csv') as f: print(f.read()) # ,a,b,c,d # ONE,11,12,13,14 # TWO,21,22,23,24 # THREE,31,32,33,34
🌐
Programiz
programiz.com › python-programming › writing-csv-files
Writing CSV files in Python
SN,Name,Contribution 1,Linus Torvalds,Linux Kernel 2,Tim Berners-Lee,World Wide Web 3,Guido van Rossum,Python Programming · Here's how we do it. import csv with open('innovators.csv', 'w', newline='') as file: writer = csv.writer(file) writer.writerow(["SN", "Name", "Contribution"]) writer.writerow([1, "Linus Torvalds", "Linux Kernel"]) writer.writerow([2, "Tim Berners-Lee", "World Wide Web"]) writer.writerow([3, "Guido van Rossum", "Python Programming"])
🌐
Real Python
realpython.com › python-csv
Reading and Writing CSV Files in Python – Real Python
January 25, 2023 - If quoting is set to csv.QUOTE_NONNUMERIC, then .writerow() will quote all fields containing text data and convert all numeric fields to the float data type.
🌐
GeeksforGeeks
geeksforgeeks.org › python › writing-data-from-a-python-list-to-csv-row-wise
Writing data from a Python List to CSV row-wise - GeeksforGeeks
July 12, 2025 - # Importing library import csv # data to be written row-wise in csv file data = [['Geeks'], [4], ['geeks !']] # opening the csv file in 'w+' mode file = open('g4g.csv', 'w+', newline ='') # writing the data into the file with file: write = csv.writer(file) write.writerows(data)
🌐
Medium
medium.com › @AlexanderObregon › how-to-read-and-write-csv-files-in-python-b84fe274d51a
How to Read and Write CSV Files in Python | Medium
October 26, 2024 - The file is opened in append mode ('a'), which adds the new rows to the end of the file without overwriting the existing data. Working with CSV files in Python is straightforward thanks to the powerful csv module.
🌐
KnowledgeHut
knowledgehut.com › https://www.knowledgehut.com › tutorials › programming tutorials
Python CSV Tutorial: Read, Write & Manipulate CSV Files in Python
September 3, 2025 - This function writes items in a sequence (list, tuple or string) separating them by comma character. This function writes each sequence in a list as a comma separated line of items in the file.
🌐
Datamentor
datamentor.io › python › csv
Python CSV: Read &; Write CSV Files (With Examples)
Here, we have used the writer() function to get a writer object, which we then used to call the writerow() function. The writerow() function writes the provided data to the csv file.
🌐
Python.org
discuss.python.org › python help
Put each values on next column of csv file - Python Help - Discussions on Python.org
April 6, 2023 - Hello All…i got the code below…I want to encode the result values into a csv file. list=[23,24,25] result = (" ".join(str(i) for i in list)) writer.writerow(["Values", result]) I want the result to be like this: Col-1 Col2 Col3 Col4 Values ...
🌐
ThePythonGuru
thepythonguru.com › python-how-to-read-and-write-csv-files › index.html
Python: How to read and write CSV files - ThePythonGuru.com
January 7, 2020 - Syntax: writer(fileobj [, dialect='excel' [, **fmtparam] ]) -> csv_writer · The writer instance provides the following two methods to write data: Here are examples: Example 1: Using writerow() Example 2: Using writerows() The output generated by both listing will be the same and it looks like this: customers.csv ·