How it works...

After the preparation work in steps 1 and 2 in the How to do it… section, step 3 is the part that does the work.

It opens a new file, movies.csv, in write (w) mode. The raw file object in csvfile then creates a writer. All this happens in a with block, so it closes the file when it's over.

Note the newline='' parameter. This is done to make the writer store the newline directly and avoid incompatibility issues.

The writer writes row by row the elements using .writerow. The first one is the HEADER, and then each of the lines of data.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.167.115