To read a CSV (Comma-Separated Values) file in Python, you can use the built-in csv
module.
csv
module:main.py11 chars2 lines
open()
function with 'r'
(read) mode:main.py70 chars3 lines
for
loop:main.py123 chars6 lines
This will print each line of the CSV file as a list of values.
next()
function to skip it:main.py171 chars9 lines
csv.reader()
function:main.py139 chars6 lines
This will read a TSV (Tab-Separated Values) file instead of a CSV file.
gistlibby LogSnag