Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.

Writing CSVs With Python's "csv" Module

Give Feedback

In this lesson, you’ll learn how to write data to CSV files using the two csv writer methods csv.writer and csv.DictWriter. The lesson also covers how to quote specific fields using constants such as csv.QUOTE_MINIMAL, csv.QUOTE_NONNUMERICand, csv.QUOTE_NONE.

Comments & Discussion

Robert on July 1, 2019

Hello,

What is the IDE or editor that you are using?

Robert

Joe Tatusko RP Team on July 5, 2019

Hi Robert! I’m using Atom and platformio-ide-terminal for the integrated terminal at the bottom in these videos.

Robert on July 9, 2019

Thank you, I’ll check those out

Dave Wilson on Feb. 23, 2020

Such a great tutorial, Joe - as always!

I’m not sure why, but my csv’s printed rows on every other line. I was able to fix it by adding a lineterminator to the employee_writer definition: employee_writer = csv.DictWriter(employee_file, fieldnames=fieldnames, lineterminator = '\n')

hayatmor on March 15, 2020

In python3 in order to work without double space you shall add:

with open('employee_file.csv', mode='w', newline='') as employee_file:

Source: Stackoverflow

Become a Member to join the conversation.