1import csv
2csv.register_dialect('unixpwd', delimiter=':', quoting=csv.QUOTE_NONE)
3with open('passwd', newline='') as f:
4 reader = csv.reader(f, 'unixpwd')
5
1import csv, sys
2filename = 'some.csv'
3with open(filename, 'rb') as f:
4 reader = csv.reader(f)
5 try:
6 for row in reader:
7 print row
8 except csv.Error as e:
9 sys.exit('file %s, line %d: %s' % (filename, reader.line_num, e))
10